title: Draw a semicircle in the background of a View
body: <p>I am trying to create a TextView whose background is a half circle. I create a oval using a ShapeDrawable. I tried to create a semicircle by using ScaleDrawable to double the size vertical size of the oval and clip it. However, the ScaleDrawable has no effect. Why not? What is the best way to draw a semicircle in the background of a View?</p>
  
  <p><strong>res/layout/activity_main.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      &gt;
      &lt;TextView
          android:id="@+id/main_view"
          android:background="@drawable/semicircle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:gravity="center_horizontal"
      /&gt;
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>res/drawable/semicircle.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;scale xmlns:android="http://schemas.android.com/apk/res/android"
      android:drawable="@drawable/circle"
      android:scaleGravity="top|clip_vertical"
      android:scaleHeight="200%"
      android:scaleWidth="100%" &gt;
  &lt;/scale&gt;
  </code></pre>
  
  <p><strong>res/drawable/circle.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="oval"
      &lt;solid
          android:color="#444" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p><strong>src/.../MainActivity.java</strong></p>
  
  <pre><code>//...
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main_activity);
          findViewById(R.id.main_view).getBackground().setLevel(10000);
      }
  //...
  </code></pre>