Spinner项目小文本在某些设备上不可见

时间:2012-05-22 20:58:36

标签: android-layout android-listview android-spinner android

我想更改微调器项目布局。布局将有两个TextView。一个是小尺寸文本,另一个是中等大小的文本。下面的布局是我正在使用的:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:minHeight="40dp"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/test1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:paddingLeft="5dp"
        android:gravity="center_vertical"
        android:text="foo" />

    <TextView
        android:id="@+id/test2"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:paddingLeft="5dp"
        android:gravity="center_vertical"
        android:text="bar" />

</LinearLayout>

这在我安装了冰淇淋三明治的A500标签上效果很好。微调器具有黑色背景,文本具有白色文本。但是,如果我在运行2.3.3的HTC Desire HD上使用完全相同的布局,则微调器背景已变为白色。无法看到文字,因为它也是白色的。

相反,我可以使用textAppearance{Small,Medium}Inverse,但情况将会逆转。该文本将在HTC Desire上显示,但不会在A500上显示。

问题changing spinner text color based on background color似乎找到了解决方案,但据我所知,textColorPrimary中包含了textAppearance{Small,Medium}

出于可维护性的原因,我想使用相同的布局,无论是什么设备或Android版本。我该怎么办?

另外,如果我可以为ListView项使用完全相同的布局,那将是很好的,再次出于可维护性原因。

0 个答案:

没有答案
相关问题