the Android devGuide explains how it is possible to reference the value of an attribute in the currently-applied theme, using the question-mark (?) instead of at (@).
Does anyone know how to do this from code, e.g. in a customized component?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In XML, it would look something like this:
programmatically, it’s a little trickier. In your activity:
And when you want to access an attribute of the theme, you would do something like this:
It’s a little more convoluted, but there you go 😉