开发者

Difference between defining a value in color and drawable tag?

<resources>
    <drawable name="red">#7f00</drawable>
....
    <colo开发者_开发问答r name="solid_red">#f00</color>
.....
</resources>

This is some part of the colors.xml from android samples directory.

Now my question is that, what is the difference between defining a color in <drawable> tag and <color> tag ?


Basically nothing. They both create a resource that is a "color" value holding a 32 bit color. One is just a drawable subtype, one is a color subtype. When you retrieve a Drawable from resources, if the resource is actually a color constant it knows how to create a Drawable object for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜