Search strip, changing the color of the path from yellow to white.

I have two questions:

1) how to change the color of the search bar (path) from yellow (default color) to white. I want to say that while I put my thumb out, it turns a line from gray to yellow. I want the track / line to remain gray or white. Basically, I want only the thumb to move without changing the color in the search bar.

2) How to change the thumb of an arrow from a rectangle to a circle / sphere / round shape.

Any pointers would be appreciated.

+47
android android-emulator
Aug 13 '10 at 20:27
source share
6 answers

I want to fulfill the answer above for people who are new to the system,

missing xmls (background_fill, progress_fill and progress may look like for a red gradient

progress.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" android:drawable="@drawable/background_fill" /> <item android:id="@android:id/progress"> <clip android:drawable="@drawable/progress_fill" /> </item> </layer-list> 

background_fill.xml

 <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#FF555555" android:centerColor="#FF555555" android:endColor="#FF555555" android:angle="90" /> <corners android:radius="5px" /> <stroke android:width="2dp" android:color="#50999999" /> <stroke android:width="1dp" android:color="#70555555" /> </shape> 

progress_fill.xml

 <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#FF470000" android:centerColor="#FFB80000" android:endColor="#FFFF4400" android:angle="180" /> <corners android:radius="5px" /> <stroke android:width="2dp" android:color="#50999999" /> <stroke android:width="1dp" android:color="#70555555" /> </shape> 

I have not completed the implementation for android: thumb, so the thumb will still be original.

So we just need to remove this line again from our xml layout, where we define the search bar

 android:thumb="@drawable/thumb" 

Good luck !!!

+91
Nov 10 2018-11-11T00:
source share

You must set the XML properties of the SeekBar:

 <SeekBar .... android:progressDrawable="@drawable/progress" android:thumb="@drawable/thumb" .... /> 

Where the progress is something like this:

 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" android:drawable="@drawable/background_fill" /> <item android:id="@android:id/progress"> <clip android:drawable="@drawable/progress_fill" /> </item> </layer-list> 

and thumb

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/thumb_fill" /> </selector> 
+68
Aug 13 '10 at 20:41
source share

Since SeekBar uses colorAccent by default, you can create a new style with your custom color as colorAccent , and then use the theme attribute to apply it to the SeekBar.

 <SeekBar> . . android:theme="@style/MySeekBarTheme" . </SeekBar> 

in the style of @style:

  <style name="MySeekBarTheme" parent="Widget.AppCompat.SeekBar" > <item name="colorAccent">#ffff00</item> </style> 
+21
Jul 09 '16 at 21:00
source share
 seekBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); seekBar.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); 
+14
Aug 02 '16 at 2:30
source share

You can simply add a shade from API level 21.

Add these properties to the search element:

Android: progressTint = "@ android: color / white" Android: thumbTint = "@ android: color / white"

Final result:

 <SeekBar android:id="@+id/is" android:layout_width="match_parent" android:max="100" android:progressTint="@android:color/white" android:thumbTint="@android:color/white"/> 
+6
Jan 08 '17 at 13:06 on
source share

Just change the accent color of your style.

 <style name="TickMarkSeekBar" parent="Theme.KefTheme"> <item name="tickMark">@drawable/tickmark</item> <item name="thumbTint">@android:color/white</item> <item name="colorAccent">@android:color/white</item> </style> 
0
Apr 10 '18 at 14:14
source share



All Articles