Skip to content Skip to sidebar Skip to footer

Android SeekBar Can't Be Full Width Even Set Padding 0 In AppCompat 23.1.0

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: <

Solution 1:

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);

    // ...
}

Solution 2:

Set this attributes in XML

android:paddingStart="0dp" 

Solution 3:

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.


Solution 4:

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


Solution 5:

Try this

android:paddingStart="0dp"
android:paddingEnd="0dp"

Post a Comment for "Android SeekBar Can't Be Full Width Even Set Padding 0 In AppCompat 23.1.0"