Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android seekbar progressdrawable: background bitmap doesnt stretch (height)

My layout xml is as follows:

 <SeekBar
        android:id="@+id/progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_margin="10dp"
        android:gravity="center"
        android:progressDrawable="@drawable/progressbar_drawable"
        android:progress="50"
        android:thumb="@drawable/progressbar_handle_selector"
        android:layout_toLeftOf="@+id/showChat"
        android:layout_toRightOf="@+id/play" />

Seekbar's progress drawable is as follows:

@drawable/progressbar_drawable

  <?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/bg_progressbar_9patch"/>
  <item android:id="@android:id/progress">
    <clip>
        <shape>
            <gradient
                android:angle="90"
                android:endColor="#d9b546"
                android:startColor="#cc520f" />
        </shape>
    </clip>
  </item>

  </layer-list>

As a result, background bitmap (white one) doesnt stretch in height and remains too low as compared to progress drawable (orange one), here is an example: enter image description here

What is more, it looks different on different screens: background bitmap has different height as compared to progress drawable. For example (another screen):

enter image description here

My question is: why aren't progress and background drawables (orange and white stripes) always of same height and what to do to make them of the same height?


UPDATE

Png resources:

enter image description hereenter image description here

like image 788
Eugene Chumak Avatar asked Nov 12 '22 13:11

Eugene Chumak


1 Answers

I created 9-patch from your image and put it in drawable-hdpi folder and everything looks fine... i have some artifacts in eclipse ui previewer but everything is OK on device... enter image description here

https://dl.dropbox.com/u/13106986/bg_progressbar_patch.9.png

like image 85
Leonidos Avatar answered Nov 15 '22 07:11

Leonidos