Overwrite android seekbar style
10,108
Solution 1
You have to implement style in xml file which you wan to implement. Then in layout xml file where you use the SeekBar, you have to just set the style in android:style=""
attribute.
In style.xml
:
<SeekBar style="@style/seekbar_style" />
Solution 2
I think you need to write your stuff into a own xml and put it into layout.
This might help you:
Android: Custom Drawable in a SeekBar widget is drawing aliased images
Author by
Atticus
Updated on June 04, 2022Comments
-
Atticus almost 2 years
I would like to overwrite the default android Widget.SeekBar style that looks like this:
<style name="Widget.SeekBar"> <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@android:drawable/progress_horizontal</item> <item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item> <item name="android:minHeight">20dip</item> <item name="android:maxHeight">20dip</item> <item name="android:thumb">@android:drawable/seek_thumb</item> <item name="android:thumbOffset">8dip</item> <item name="android:focusable">true</item> </style>
How can I do that? I have tried declaring the style again in the
manifest.xml
but that does not work. -
Atticus over 13 yearsOr I can simply declare a property (i.e. android:thumbOffset="19px") in my layout xml where I am declaring the SeekBar.
-
Beasly over 13 years@Atticus yes but use "dp"/"dip" instead of "px". These are desity independent pixel. Its better for supporting multiple screens.