【发布时间】:2013-06-20 00:38:45
【问题描述】:
我有一个奇怪的问题,关于在我的摩托罗拉 Defy 2.2 中显示从微调器中选择的文本。我创建了一个布局,它有一个微调器,用户可以从中选择一个选项,但问题是即使我从微调器列表中选择了一个项目它永远不会在框中显示该项目。我知道默认情况下 defy 中的文本颜色是白色,我的布局背景也是白色的,这会隐藏文本,但我还在布局中为微调器指定了 text-color 属性为黑色它仍然不显示文本。我的布局如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20.0dip"
android:layout_marginRight="20.0dip"
android:layout_marginTop="7.0dip"
android:background="@drawable/rectangle_shape" >
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right|center"
android:gravity="right|center"
android:paddingBottom="7.0dip"
android:paddingLeft="10.0dip"
android:paddingRight="8.0dip"
android:paddingTop="7.0dip"
android:text="Concession"
android:textColor="@color/white"
android:textSize="16.0sp" />
<Spinner
android:id="@+id/CSpinner"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:background="@drawable/rectangle_shape_middle"
android:entries="@array/C_arrays"
android:paddingLeft="6.0dip"
android:prompt="@string/C_prompt"
android:textColor="@color/black"
android:textSize="16.0sp" />
<ImageView
android:id="@+id/SpinnerSelector"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:background="@drawable/rectangle_shape_end"
android:paddingLeft="3.0dip"
android:paddingRight="3.0dip"
android:src="@drawable/ic_navigation_expand" />
</LinearLayout>
</LinearLayout>
该代码在三星 Galaxy s2、s3 和 Note 等其他手机上也能正常工作。请帮帮我。
提前致谢
【问题讨论】:
-
我认为 Spinner 没有属性 android:textColor。也许我需要为此使用 java。
-
我找到了我的解决方案here
标签: android android-layout android-spinner