3

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.

1 Answer 1

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.