5

我的应用程序有一个带有自定义 thumbOffset 的搜索栏。它在某些设备上无法正常工作(例如我自己的三星 Galaxy GIO Android 2.3.3)

(我的应用是为 Android 2.1 构建的,我无法更改)

我制作了一个带有搜索栏的简单应用程序 - thumbOffset 在我的手机上仍然无法正常工作(但在其他一些设备上正常工作 - 请参阅 UPD):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
          a:orientation="vertical"
          a:layout_width="fill_parent"
          a:layout_height="fill_parent">

    <SeekBar a:id="@+id/lights_downwash_slider"
         a:layout_width="280dp"
         a:layout_height="wrap_content"
         a:layout_gravity="center_horizontal"
         a:layout_margin="5dp"
         a:thumbOffset="-15dp"
         a:maxHeight="20dp"
         a:minHeight="20dp"
         a:progress="0"/>
</LinearLayout>

有没有人遇到同样的问题并有解决方案?

UPD:在三星 Nexus (android 4.0.4)、模拟器 2.3 和 4.0.3 上正常工作

不适用于模拟器 2.1 和三星 Galaxy Gio (2.3.3)

4

1 回答 1

6

我遇到了同样的问题。我在运行时用等效的 API (setThumbOffset) 解决了这个问题。(不在设计时使用 xml)

请参阅下面的等效 API。 http://developer.android.com/reference/android/widget/AbsSeekBar.html#setThumbOffset(int )

于 2012-05-22T05:36:34.680 回答