when I update android support lib from 23.0.1 to 23.1.0, I find the SeekBar is not full width any more.
this is the test XML file:
Try adding the parameters paddingStart
and paddingEnd
to 0dp
in the xml file. If your app is compatible with Rtl you will need to add those in order to visualize the seekBar with no padding otherwise it will show with padding even if using it in a Ltr language.
As Didac mentioned you can set the padding to 0 in xml.
But make sure you set the padding after you set the progressTint
or progressDrawable
.
I had a similar problem (where I was setting progressDrawable). Once I set the padding as 0 after setting the progressDrawable
, the seekbar
padding has gone
Set this attributes in XML
android:paddingStart="0dp"
finally, I just have a sudden thought. why not try modify it by java code. It works! following is the sample code:
protected void initViews(Context context) {
LayoutInflater.from(context).inflate(getLayoutResId(), this);
ButterKnife.bind(this);
// set style, just once
seekBar.setProgress(0);
seekBar.setMax(0);
seekBar.setPadding(0, 0, 0, 0);
// ...
}
if you seekBar.setPadding(0, 0, 0, 0); may be the thumb can't show complete。 First, you should find what result this. In fact, in the seek bar style, you can find this.
<style name="Base.Widget.AppCompat.SeekBar" parent="android:Widget">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/abc_seekbar_track_material</item>
<item name="android:indeterminateDrawable">@drawable/abc_seekbar_track_material</item>
<item name="android:thumb">@drawable/abc_seekbar_thumb_material</item>
<item name="android:focusable">true</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
</style>
so change the style with paddingLeft and paddingRight