Android SeekBar can't be full width even set padding 0 in AppCompat 23.1.0

custom seekbar in android
android seekbar with indicator
how to set seekbar value in android
android seekbar display value
seekbar android github
android seekbar color
seekbar example in android
android seekbar example programmatically

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:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:divider="@drawable/space_divider"
    android:orientation="vertical"
    android:padding="8dp"
    android:showDividers="middle">

    <View
        android:layout_width="match_parent"
        android:layout_height="20dp"
        android:background="@android:color/black"/>

    <!-- default SeekBar -->
    <SeekBar
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:progress="50"
        android:progressTint="@android:color/holo_red_dark"/>

    <!-- padding=0 -->
    <SeekBar
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:padding="0dp"
        android:progress="50"
        android:progressTint="@android:color/holo_red_dark"/>

    <!-- padding=40 -->
    <SeekBar
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:padding="40dp"
        android:progress="50"
        android:progressTint="@android:color/holo_red_dark"/>

    <android.support.v7.widget.AppCompatSeekBar
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:padding="0dp"
        android:progress="50"/>

</LinearLayout>

It works well under support lib 23.0.1, like following screenshot. SeekBar has default padding, when I set padding=0 manual, it can be full width. and AppCompatSeekBar is not exist yet.

but under support lib 23.1.0, whether I set how much of padding, SeekBar and AppCompatSeekBar has no any change, like following screenshot.

so, is this the bug of support lib, any body meet this problem and how to resolve it?

thank you~!

update: It totally confused me, I just have another test, I create a new project, whether I use AppCompat 23.0.1 or 23.1.0, SeekBar neither can be full width after set padding=0, (the compileSdkVersion is 23, buildToolsVersion is "23.0.1", targetSdkVersion is 23). anyway, I want to know how to make SeekBar full width when set padding=0 not work.

the build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.test.seekbar"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.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);

    // ...
}

SeekBar Tutorial With Example In Android Studio, The above code snippet will show the SeekBar like as shown below. Android Indeterminate Seek Bar Example Diagram. This is how we can define the Progress� Android SeekBar can be defined as below – Android seekBar is an extension of progressBar that have draggable thumb. User can drag the thumb back and forth to set current progress value. Note – Placing focusable widget to left or right of the seekBar widget is discouraged. Different Attributes of Android SeekBar Widget

Set this attributes in XML

android:paddingStart="0dp" 

Android SeekBar with Examples, onStopTrackingTouch: In this method, when the user stops dragging, then this method will called automatically. Below are the steps for Creating SeekBar Android� Android seekBar is a modified version of progressBar that have draggable thumb in which a user can drag the thumb back and forth to set current progress value.We can use seekbar in our android device like Brightness control, volume control etc.

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.

Android, Here is a one simple way,. Add a textView in your XML; Change it's position with the movement of the seekBar; That will position it using setX(); If you want you� 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. Placing focusable widgets to the left or right of a SeekBar is discouraged.

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

android Seekbar show progress value along the seekbar, Hey guys, in this quick tutorial we will learn, how to read the progress out of a SeekBar using Duration: 3:53 Posted: Oct 24, 2017 Android SeekBar is the extension of ProgressBar.SeekBar allows the user to change the value using touch event/draggable thumb/left right arrow keys. SeekBar has a thumb that can be slided in order to choose a value between 0 and some maximum that can be set from the developer.

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

SeekBar - Listening to Progress Changes, In this tutorial we will learn How to use SeekBar in Android Using The user can touch the Duration: 10:12 Posted: Mar 14, 2015 A custom SeekBar on Android, which can be changed the size ,color , thumb drawable , tick drawable , tick text and indicator , also , will show an indicator view with progress above SeekBar when se

Android Tutorial for Beginners 19 # SeekBar, In this example, I will show you how to use a SeekBar to control the text size of the TextView control. You can use it to control other values in your� I have a listview with seekbar, each seekbar represents 100% of a value of product. By moving the seekbar the % value can be changed, I want to show the change in value along the seekbar while the

Understanding the SeekBar in Android With an Example, Android SeekBar is a kind of ProgressBar with draggable thumb. The end user can drag the thum left and right to move the progress of song, file download etc. This is one stop solution for both android developers and learners. Learners can refer our basic tutorials and developers can refer Material Design, Networking and Intermediate tutorials. Stick with us for a while and we promise you will become an Android Rockstar. All the Best !!

Android Seekbar example, You can set default selected value by setting value for progress attribute which gets changed as user drags the thumb. Below example layout xml� android seekbar example - In Android, SeekBar is an extension of ProgressBar that adds a draggable thumb A user can touch the thumb and drag left or right to set the value for current progress. SeekBar is one of the very useful user interface element in Android that allows the selection of integer values using a natural user interface.

Comments
  • ohh.. Guy!! I've tried android:padding="0dp" in style and in view xml and this hasn't helped. Thank you!
  • It works but does any know what's actually going on and why this happens ?
  • We can't get equi-efficacious thereby setting the padding in XML?
  • This is it. Thanks. Ya you just need to override the default padding.
  • However, be aware that padding set to 0dp will clip the thumb when in the outer positions (for instance when the seekbar is taking up the entire width of the screen).