I have an android app on which, when the user taps a TextView, I would like to apply a defined style.
I thought to find a textview.setStyle() but it doesn’t exists. I tried
textview.setTextAppearance();
but it does not work.
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.
I did this by creating a new XML file
res/values/style.xmlas follows:I also have an entries in my “strings.xml” file like this:
Then, in my code I created a ClickListener to trap the tap event on that TextView:
EDIT:
As from API 23 ‘setTextAppearance’ is deprecated
To change it back, you would use this: