有没有一种简单的方法可以在Android

有没有一种简单的方法可以在Android

本文介绍了有没有一种简单的方法可以在Android Studio中查看颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我搜索一种颜色,它将在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.

https://www.hexcolortool.com/

这篇关于有没有一种简单的方法可以在Android Studio中查看颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 00:54