简体   繁体   中英

set a color value in the attributes file

I need a hit on how to set a color I have defined in the color.xml file inside my attrs.xml file.

for example in color.xml I use <color name="mypreferencesummary">#e27229</color>

and in attrs.xml I use <attr name="mypreferencesummary" format="reference|color" />

when I call it I get the android.view.InflateException: Binary XML file line #43: Error inflating class <unknown> exception.

Is it actually occurred from those xmls? That error seems to be a missing constructor error when you create custom view and use it in xml layout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM