androidseekbar

Change size of Android-Seekbar?


I have a question concerning seekbars. I tried several things but nothing helped. I want to change the height of the seekbar, but not the complete seekbar, only the bar where you scroll over with your thumb. I tried several things e.g. setBackGroundDrawable and setProgressDrawable and made my own drawables, but the drawable-size is fixed to the size of the Standard-Android-Seekbar. What can I do now?


Solution

  • You have to add some padding in all directions and than set the min and max height. Here are one example that I used:

    <?xml version="1.0" encoding="utf-8"?>
    <SeekBar xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:progressDrawable="@drawable/custom_player_seekbar_background"
            android:paddingTop="10px" 
            android:paddingBottom="10px" 
            android:thumb="@drawable/bt_do_player" 
            android:paddingLeft="30px" 
            android:paddingRight="30px" 
            android:minHeight="6dip"
            android:maxHeight="6dip" 
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"/>