Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

@color/black vs @android:color/black

As the title suggests, I noticed there were two options for black color, and that made me wonder, is there any difference between @color/black and @android:color/black when styling texts etc.? Is there a reason why those two exist separately?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

@android:color/black – this references to Android framework built-in value, which is unchanged and points on #000000 color. Until Android folks won’t make for us any joke in some OS release it is safe and reliable reference to use, in API since the beginning

@color/black – this points on your custom reference declared in your app. You can put in there any color in fact, thus in that way quick re-styling whole app. (btw. it’s better to use location-naming e.g. list_separator or fragment_background_default for keeping this possibility) Or you can remove this entrance in colors.xml (most common) and then @color/black becomes "unresolveable" (app won’t build)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading