Problem reproduction:
When selector is used, it is expected that the button image will change color when you press the button. The Code is as follows:
<Button
Android: Id = "@ + ID/btn_match"
Style = "@ style/dashboardbutton"
Android: drawabletop = "@ drawable/btn_match"
Android: text = ""/>
The selector is written in
Btn_match.xml controls the status of buttons under various States.
However, the button does not change color during actual operation.
Cause:
First, this is not a problem caused by incorrect order of pressed, selected, and default;
The real reason is that there is an image named btn_match.png in the drawable folder of my project. The system first resolves btn_match in Android: drawabletop = "@ drawable/btn_match" to btn_match.png, rather than the expected btn_match.xml.
When you press Ctrl and move the mouse to "@ drawable/btn_match", there will be two prompt statements: the first is btn_match.png, and the second is btn_match.xml. the system selects btn_match.png as the priority.
Solution:
Delete btn_match.png or rename it.