android - Seekbar progress drawable show wrong issue when its progess value is zero -
i new in android platform. trying develop custom seek bar using .9 path image , xml.i created problem occurs when seekbar appear first time when activity start show wrong progress level when progess level define 0 in xml. check out image
here xml file code
<seekbar android:id="@+id/slider1" android:layout_width="match_parent" android:layout_height="wrap_content" android:progress="0" android:splittrack="false" android:layout_margintop="5px" android:layout_marginbottom="5px" android:background="@android:color/transparent" android:progressdrawable="@drawable/green_seekbar" android:thumb="@drawable/slidercontralbt2" />
green_seekbar.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <nine-patch xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/sb" android:dither="true" /> </item> <item android:id="@android:id/progress" android:drawable="@drawable/green_seekbar_progress" />
green_seekbar_progress.xml
<?xml version="1.0" encoding="utf-8"?>
<item > <clip> <nine-patch xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/green" android:dither="true" /> </clip> </item>
finally reach solution. put below code in oncreate method.
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ..... ..... slider1.setprogress(0); slider1.invalidate(); }
Comments
Post a Comment