TextColor在Android中的XML是不是工作?
我有一个Android应用程序,我有一个textview来表示一个问题:
I have an android app where I have a textview to represent a question :
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="This is a very very very very very long Question ?"
android:textSize="40dp"
android:layout_marginBottom="30dp"
android:id="@+id/question"
android:textColor="#d0d0"
android:textColorHint="#d0d0"
android:textColorLink="#d0d0"
android:textColorHighlight="#d0d0"
android:background="#d0d0d0"/>
#d0d0 = Light Green
#d0d0 =浅绿色
As you see I've tried all of:
正如你看到的,我尝试了所有的:
android:textColor="#d0d0"
android:textColorHint="#d0d0"
android:textColorLink="#d0d0"
android:textColorHighlight="#d0d0"
But the Text view Color still the same (Gray) in the phone
But in Android studio it's working fine
但手机中的文字视图颜色仍然相同(灰色)
I don't want a java solution I want to change the color with XML
我不想要一个java解决方案我想用XML改变颜色
Thank you in advance
颜色以4字节表示:alpha,红,绿,蓝。每个值范围0到255.
尝试用十六进制格式#RRGGBB表示颜色代码。它应该工作。它是android xml文件中的传统方法。
Colors are Represented in 4 bytes: alpha, red, green, blue. Each value range 0 to 255. You try to represent the color codes with hexadecimal format #RRGGBB. It should work. It is traditional way in android xml files.
在我的手机中,你的代码是工作。但可能有些手机只遵循十六进制格式的颜色表示。
In my mobile your code is working. But may be some mobiles follows only hexadecimal format color representation.