Answer the question
In order to leave comments, you need to log in
How to implement button shading (quiz application)?
I am a beginner Android developer. I am writing a quiz app. Faced such a problem:
There is a question + 4 buttons for answer options. I did how to display information about the correctness or incorrectness of the answer.
But I also want that after choosing the answer, the buttons are highlighted - three red (not the correct answer) and one green (correct answer). Please help with advice on how to implement this.
Answer the question
In order to leave comments, you need to log in
In this case, you should use the `setBackgroundTintList` method
example
mButton.setBackgroundTintList(getContext().getResources().getColorStateList(R.color.your_xml_name));
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="#000" />
</selector>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question