seekbar - android - cant put thumb on center of a seek bar -
i want know how set thumb @ center of seekbar. don't know how express, i'll add link of pic. first img seekbar design guides, , belows seekbars.
(ignore corners. fixed after capturing imgs.) @ first, designer, got 2 separate img of text, , bad. combined those. thought work thumb. got these result... please me.. thank you!
drawable : progressbar_goodbad xml
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <gradient android:startcolor="#f5c0bd" android:centercolor="#f5c0bd" android:centery="0.75" android:endcolor="#f5c0bd" android:angle="270"/> <padding android:left="10dp" android:top="1dp" android:right="10dp" android:bottom="1dp"/> <corners android:bottomrightradius="10dp" android:bottomleftradius="10dp" android:topleftradius="10dp" android:toprightradius="10dp"/> </shape> </item> <item android:id="@android:id/secondaryprogress"> <clip> <shape> <gradient android:startcolor="#234" android:centercolor="#234" android:centery="0.75" android:endcolor="#a24" android:angle="90"/> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp"/> <corners android:bottomrightradius="10dp" android:bottomleftradius="10dp" android:topleftradius="10dp" android:toprightradius="10dp"/> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip> <shape> <gradient android:startcolor="#fc9a94" android:centercolor="#fc9a94" android:centery="0.75" android:endcolor="#fc9a94" android:angle="90"/> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp"/> <corners android:bottomrightradius="10dp" android:bottomleftradius="10dp" android:topleftradius="10dp" android:toprightradius="10dp"/> </shape> </clip> </item> </layer-list>
part of main layout xml
<seekbar android:id="@+id/seekbar_fun" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginbottom="3dp" android:paddingleft="10dp" android:paddingright="10dp" android:max="100" android:progress="60" android:progressdrawable="@drawable/progressbar_goodbad" android:thumb="@drawable/f_02_good_bad_text" />
(answer found in twinsens link.)
your thumb image needs have it's yellow dot @ center (horizontally); add transparent pixels left or right make so. then, change android:thumboffset
half thumb image size. example, if image 10dp in width, set android:thumboffset
5dp.
Comments
Post a Comment