progress bar - Show custom progressbar in android -
i want show custom progress-bar, represents battery charged status 25%, 50% etc , should follows...please me in advance
i have tried following coding..
drawable/custom_progressbar.xml follows..
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@android:id/background"> <shape android:shape="rectangle" > <corners android:radius="25dip" /> <gradient android:centercolor="@android:color/black" android:endcolor="@android:color/black" android:gradientradius="200" android:startcolor="@android:color/black" android:type="radial" /> </shape> </item> <item android:id="@android:id/secondaryprogress"> <clip> <shape> <corners android:radius="25dip" /> <gradient android:startcolor="@android:color/white" android:centercolor="@android:color/white" android:centery="0.75" android:endcolor="@android:color/white" android:angle="270" /> </shape> </clip>
then used above progressbar follows in battery_status.xml follows..
<progressbar android:id="@+id/battery_pb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:minwidth="262dip" android:minheight="100dip" android:max="100" android:layout_marginleft="0dip" android:layout_marginright="21dp" style="?android:attr/progressbarstylehorizontal" android:progressdrawable="@drawable/custom_progressbar"/>
but didn't way how want progressbar please me..
calculate battery status percentage ratio.try set battery level progressbar status progressbar.setprogress(battery level);
this link may http://learnandroideasily.blogspot.in/2013/05/customizing-progress-bar-in-android.html
Comments
Post a Comment