Android: textColor of disabled button in selector not showing?

前端 未结 5 1409
梦毁少年i
梦毁少年i 2020-11-30 21:24

I am trying to make a button with a selector my button can have the following states:

  • Enabled/Disabled
  • Pressed/Not Pressed

According to

5条回答
  •  执笔经年
    2020-11-30 21:41

    You need to also create a ColorStateList for text colors identifying different states.

    Do the following:

    1. Create another XML file in res\color named something like text_color.xml.

      
      
        
         
        
      
      
    2. In your style.xml, put a reference to that text_color.xml file as follows:

      
      

    This should resolve your issue.

提交回复
热议问题