Android: Make custom seekbar opaque -


hi can tell me why seekbar's background , progress have opacity , can't removed have set alpha 1.0. below progress_drawable.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">  <item android:id="@android:id/background">     <shape>         <corners android:radius="5dip" />         <gradient             android:alpha="1.0"             android:startcolor="#000000"             android:endcolor="#000000"/>      </shape> </item>  <item android:id="@android:id/secondaryprogress">     <clip>         <shape>             <corners android:radius="5dip" />             <gradient                 android:alpha="1.0"                 android:startcolor="#000000"                 android:endcolor="#000000" />         </shape>     </clip> </item>  <item android:id="@android:id/progress">     <clip>         <shape>             <corners android:radius="5dip" />             <gradient                 android:alpha="1.0"                 android:endcolor="#2e2dff"                 android:startcolor="#2e2dff" />             <solid android:color="#2e2dff" />         </shape>     </clip> </item> 

and seekbar tag in activity xml:

<seekbar     android:padding="0dp"     android:id="@+id/normalseekbar"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_below="@+id/imgpenguin"     android:alpha="1"     android:progress="0"     android:progressdrawable="@drawable/progress_drawable"     android:secondaryprogress="0" /> 

i got result want bars opaque, please advise , in advanced.

just found issue:

normalsb.setenabled(false); 

i shouldn't use setenabled(false) avoid user drag on thumb, instead, have done reset progress when fromuser == true:

normalsb.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() {          int originalprogress;          @override         public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) {              float seekbarstarting = seekbar.getx();             float seekbarwidth = seekbar.getwidth();             float seekbaroffset = seekbar.getthumboffset();             float ratio = (float) progress / seekbar.getmax();              float scaledprogress = ratio * seekbarwidth;              if (scaledprogress > imgpenguin.getwidth()) {                 imgpenguin.setx(seekbarstarting - imgpenguin.getwidth() + scaledprogress);             }              if (fromuser == true) {                 seekbar.setprogress(originalprogress);             }          }          @override         public void onstarttrackingtouch(seekbar seekbar) {             originalprogress = seekbar.getprogress();         }          @override         public void onstoptrackingtouch(seekbar seekbar) {         }     }); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -