我正在使用 ViewFlipper 来交替一些不同的relativelayout。我的布局非常简单。
<RelativeLayout
android:id="@+id/display_info_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:text="@string/information"
android:color="@color/black" />
</RelativeLayout>
问题: 名为“黑色”的颜色在我的资源中定义为“#000000”。文本元素在其他布局中显示为正确的黑色,但在这个布局中,它显示为暗灰色。
其他布局
这个布局
问题:
- 可能是什么原因造成的?
- 如何修复它?
最佳答案
您应该使用android:textColor我不认为 android:color 作为属性存在
所以:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:text="@string/information"
android:textColor="@color/black" />
关于android - 黑色文本在 Android View 中显示为灰色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12978988/