ixx
ixx

Reputation: 32269

Seekbar thumb doesn't show if it's a shape

Seekbar:

<SeekBar
    android:id="@+id/seekBar"
    android:layout_width="0dip"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:paddingLeft="20dip"
    android:paddingRight="20dip"
    android:progressDrawable="@drawable/bg"
    android:thumb="@drawable/thumb"
    android:thumbOffset="0px" />

Problem: Works if thumb drawable it's a bitmap, but with a shape like

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid android:color="#ffff0000" />
</shape>

The thumb doesn't show.

I tried with things like this:

Drawable thumb = getResources().getDrawable(R.drawable.thumb);
thumb.setBounds(0,0,20,20);
seekBar.setThumb(thumb);

But still the same problem. The drawable is "there", it can be dragged, and it's in the correct place, but it's not visible. Any help? Thanks in advance!

Upvotes: 0

Views: 3391

Answers (1)

AwadKab
AwadKab

Reputation: 3064

Try add size to your shape this:

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid android:color="#ffff0000" />
<size
        android:width="20dp"
        android:height="20dp" />
</shape>

Upvotes: 9

Related Questions