Creating a bent line like an arc in Android using xml in drawable -
what did..
<item> <rotate android:fromdegrees="40" android:todegrees="20" android:pivotx="25%" android:pivoty="50%" > <shape android:shape="line" android:top="1dip" > <stroke android:width="1dip" android:color="#ff0000" /> </shape> </rotate> </item>
it rotates doesn't bend. needs bent form arc shape
any idea?
you can draw ring
shape, rotate based on preference , use progressbar
progressdrawable
set progress.
drawable.xml
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="150" android:todegrees="150"> <shape android:shape="ring" android:thickness="10dp" android:innerradius="20dp" android:uselevel="true"><!-- line fixes issue lollipop api 21 --> <solid android:color="@color/colorprimary"/> </shape> </rotate>
layout.xml
<progressbar style="?android:attr/progressbarstylehorizontal" android:layout_width="120dp" android:layout_height="120dp" android:progressdrawable="@drawable/widget_arc" android:indeterminate="false" android:max="100" android:progress="67" />
you can set progress dinamically , easy animate it
*use dimen res values
Comments
Post a Comment