android - 黑色文本在 Android View 中显示为灰色

标签 android colors textview viewflipper

我正在使用 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”。文本元素在其他布局中显示为正确的黑色,但在这个布局中,它显示为暗灰色。

其他布局 Other layout with normal black text

这个布局 This layout with grey text

问题:

  1. 可能是什么原因造成的?
  2. 如何修复它?

最佳答案

您应该使用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/

相关文章:

javascript - react native : elevation (shadow) and transparency on button don't work together as needed

android - 如何根据在android中播放的歌曲显示歌词?

Android显示html文本的最佳方式

android - 谷歌云消息 : duplicate token in database

javascript - JS : orientationchange before?

android - 更改笔划颜色会更改以前的笔划颜色

javascript - Photoshop 用于匹配图像颜色的算法

html - 为什么 3 位十六进制颜色代码值在 Internet EXPLORER 中的解释不同?

android - setText 无法在 TextView 中将数字显示为文本

android - 从 url 将图像设置为壁纸