问题描述
如果我搜索一种颜色,它将在R.java
中返回我的结果:
If I search for a color, it returns me results in R.java
:
public static final int cardview_light_background=0x7f040027;
如何查看此颜色代码?这是一个ARGB代码,我很难找到它.
How can I view this color code? It is an ARGB code and I can't find it easily.
有没有一种简单的方法来查看颜色?
Is there an easy way to see the color?
推荐答案
如果您正在查看R.java
文件,则会在其中注册所有资源,包括颜色,但此值0x7f040027
是资源ID,但不是颜色
If you are looking into the R.java
file, all the resources including colors are registered there but this value 0x7f040027
is a resource id but NOT a color.
public static final int cardview_light_background=0x7f040027;
您可以在同一colors.xml
文件中看到预览,并且必须在此处优先定义颜色:
You can see a preview inside the same colors.xml
file and you must define the colors preferently here:
如果要查看预览,请直接转到colors.xml
文件.
if you want to see the preview go directly to the colors.xml
file.
- FF:Alpha通道
- AA:红色.
- BB:绿色.
- CC:蓝色.
- FF : alpha channel
- AA : Red Color.
- BB : Green Color.
- CC : Blue Color.
但是等等,所指的颜色是SDK中的颜色,要预览该颜色,您可以编写以下代码行:
But wait, the color refered is a color from the SDK, to have a preview of this color you can write this line of code:
点击蓝色说明,以从SDK colors.xml
文件的左侧获取预览:
click in the blue description to get the preview in the left side from the SDK colors.xml
file:
在互联网上,您可以找到几个页面来预览颜色,可以将颜色定义为ARGB或十六进制格式.
In internet you can find several pages to have a preview of the color, you can define the color as ARGB or Hexadecimal format.
这篇关于有没有一种简单的方法可以在Android Studio中查看颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!