Bruno Laurinec
Bruno Laurinec

Reputation: 948

Android - Change seekbar bar size

I'm playing a bit with Android developing some sample applications and came across issue I can't get over with. I'd like to change width of "bar" of SeekBar view.

What I want could be better seen on screenshot provided

https://i.sstatic.net/XczAf.png

Could some please be so kind and help me out?

Thanks a lot in advance

Upvotes: 0

Views: 2330

Answers (2)

Sushant Gosavi
Sushant Gosavi

Reputation: 57

You can use thumb drawable for to change hight and and thumb image Use below line in seekbar xml file

android:thumb="@drawable/seekbar_thumb_draw"



<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/seekbar_thumb_draw" />

//seekbar_thumb_draw.xml

<?xml version="1.0" encoding="utf-8"?>

<item>
    <shape>
        <size
            android:height="40dp"
            android:width="40dp" />

        <solid android:color="@android:color/transparent" />
    </shape>
</item>
<item android:drawable="@drawable/seekbar_thumb_image"/>

seekbar_thumb_image is image for thumb that u want

Upvotes: 1

UPGRAYEDD
UPGRAYEDD

Reputation: 435

Photshop the exact size that you want. Then save it in your drawables folder. Then reference it in the xml code for your seekbar.

<SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="wrap_contentt"
        android:layout_height="wrap_content"
        android:thumb="@drawable/seek_thumb_verywidebar" />

Upvotes: 0

Related Questions