Android .xml files: Why do predefined colors not work for me?

后端 未结 6 1747
慢半拍i
慢半拍i 2020-12-06 09:03

When I look at misc. Android tutorials and examples when it comes to specifying colors I very often see constants like @color/red or @color/black e

6条回答
  •  旧时难觅i
    2020-12-06 09:50

    Make sure your color XML file is within the values folder, not a colors folder.

    So you should have...

    values/colors.xml

    
        #FF0000
    
    

    and NOT this...

    color/colors.xml

    
        #FF0000
    
    

    Note that the tag is resources, not selector.

提交回复
热议问题