I have a SeekBar
in a RelativeLayout
whose width is equal to the screen width.
I applied layout_width="match_parent"
to the SeekBar
but it seems to keep some empty space on both sides of the SeekBar
to accommodate the thumb.
I also tried using android:thumb="@null"
The thumb is gone but not the empty space on the sides.
I really need to make the SeekBar
width match the parent's. Could somebody help me with this? Maybe I could create a custom SeekBar
class and set the width to the parent width in onMeasure(). If this is a possible solution, I don't know how I could pass the parent width to the SeekBar
class.
Any help is appreciated. Thank you.
Edit the maxHeight to your desired height what you want to achieve. It will work perfectly. Show activity on this post. You have to add some padding for all directions and also set the min and max height of the SeekBar.
You can use the Slider provided by the Material Components Library. Use the app:trackHeight="xxdp" (the default value is 4dp ) to change the height of the track bar.
Show activity on this post. Then I used vector code in . xml file, which has attrs android:width="28dp" and android:height="28dp" in the vector tag. Here we can change the size of the thumb.
A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys.
Try to define following with the SeekBar
in xml:
android:padding="0dp"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With