Android SeekBar ProgressDrawable: 背景位图不会拉伸(高度)

5

我的布局xml如下:

 <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" />

进度条的进度图像如下:
@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>

因此,背景位图(白色)在高度上不会拉伸,并且相对于进度可绘制对象(橙色)仍然过低,以下是一个示例: enter image description here 此外,在不同的屏幕上看起来也不同:与进度可绘制对象相比,背景位图的高度不同。例如(另一屏幕): enter image description here 我的问题是:为什么进度和背景可绘制对象(橙色和白色条纹)的高度不总是相同的,怎样才能使它们的高度相同?
更新:
PNG 资源: enter image description here enter image description here
1个回答

1

制作一个包含相关资源的归档文件并分享它,我会看看出了什么问题。 - Leonidos
它适用于API 11+,我明天会更精确地测试API 8-10。 - Eugene Chumak
似乎在Android 2.2上启动时,9-patch无法拉伸 - 这可能是什么问题? - Eugene Chumak
我不知道。我会在2.2版本上检查。 - Leonidos
1
这个链接有误,请检查。https://dl.dropbox.com/u/13106986/bg_progressbar_patch.9.png - Sino Raj
请重新上传9patch文件。 - serj

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接