Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

seekbar customization: progress and secondaryProgress property not stretch pictures default

I customize my seekbar like below:

<SeekBar android:id="@+id/progress_seekbar" android:background="@drawable/play_progress_bg"
    android:layout_centerHorizontal="true" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_marginBottom="-9dp"
    android:layout_above="@id/playwidget" android:progressDrawable="@drawable/progress_seekbar_style"
    android:thumb="@drawable/thumb_progress" />

in my progress_seekbar_style.xml file, I specified it like this:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background" android:drawable="@drawable/play_progress_01" />
    <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/play_progress_02" />
    <item android:id="@android:id/progress" android:drawable="@drawable/play_progress_03"/>
</layer-list>

I want to use this seekbar customization for different screen size; but when it display on the large screen like 600x1024, the seekbar will repeat the picture which I set in "@android:id/background,secondaryProgress/progress " , not stretch my pictures. and I need it automatically stretch my picture to fill parent width. that is what I want, but it just repeat the picture.

can you help? thanks.

like image 778
gladman Avatar asked Jan 31 '26 02:01

gladman


1 Answers

Try using nine-patch images. Nine-patch is stretched if you use it for background (even for progress or seek bar).

For testing just rename your image from img.png to img.9.png

like image 107
Serafim Suhenky Avatar answered Feb 01 '26 15:02

Serafim Suhenky