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 th
To clip the oval shape, just embed it in a ClipDrawable like this:
res/drawable/semicircle.xml
ClipDdrawable common purpose is to create custom progress bars. It clips a part of its content and progressively displays it when its "level" property increases in a range of [0; 10000] (0=hidden, 10000=fully displayed).
clipOrientation is the orientation of the clipping progress. gravity is the clipping progress start edge/side.To get a half circle, set this ClipDrawable as your view background, and programmatically tweak its "level":
//...
findViewById(R.id.my_view).getBackground().setLevel(5000)
//...
Works on all Android versions ("Added in API level 1") and requires no custom view.
;-)