TextColor在Android中的XML是不是工作? [英] TextColor in Android XML is not working?

查看:262
本文介绍了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.

这篇关于TextColor在Android中的XML是不是工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆