title: Put View Into Circular Layout Corner Android
body: <p><a href="https://i.stack.imgur.com/Rs0hQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rs0hQ.png" alt="enter image description here"></a>I am made a semi circle custom layout. In which i want to put the my view into the outer surface of the semi circle. but it i not showing exactly i want.</p>
  
  <p>I the below code I have override the OnLayout method of view group.<br>
  I have posted my code below:-</p>
  
  <pre><code>@Override
      protected void onLayout(boolean changed, int l, int t, int r, int b) {
  int mAngleRange = 180;
          final int childs = getChildCount();
  
          float totalWeight = 0f;
  
          for (int i = 0; i &lt; childs; i++) {
              totalWeight += 1;
          }
  
          float startAngle = 270;
          final int width = getWidth();
          final int height = getHeight();
  
          for (int i = 0; i &lt; childs; i++) {
              final View child = getChildAt(i);
  
              final LayoutParams lp = layoutParams(child);
  
              final float angle = mAngleRange / totalWeight * 1;
  
              final float centerAngle = startAngle + angle / 2f;
  
              final int x;
              final int y;
  
              if (childs &gt; 1) {
                  int radius = getResources().getDimensionPixelOffset(R.dimen.item_radius);
                  x = (int) (radius * Math.cos(Math.toRadians(centerAngle)) + 0);
                  y = (int) (radius * Math.sin(Math.toRadians(centerAngle))) + height / 2;
              } else {
                  x = width / 2;
                  y = height / 2;
              }
  
  
              final int left = lp.width != LayoutParams.MATCH_PARENT ? x : 0;
              final int top = lp.height != LayoutParams.MATCH_PARENT ? y : 0;
              final int right = lp.width != LayoutParams.MATCH_PARENT ? x + child.getMeasuredWidth() : width;
              final int bottom = lp.height != LayoutParams.MATCH_PARENT ? y + child.getMeasuredHeight() : height;
  
              Log.d(CircularOverlayLayout.class.getName(), "left =" + left + " top =" + top + " right =" + right + " bottom = " + bottom);
              child.layout(left, top, right, bottom);
  
  
              startAngle += angle;
  
          }
      }
  
  &lt;com.trignodev.customuidemo.CircularOverlayLayout
          android:id="@+id/normalWithRange"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@android:color/white"&gt;
  
          &lt;View
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:background="#ff0000" /&gt;
  
          &lt;View
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:background="#00ff00" /&gt;
  
          &lt;View
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:background="#0000ff" /&gt;
  
      &lt;/com.trignodev.customuidemo.CircularOverlayLayout&gt;
  </code></pre>