Android: textColor of disabled button in selector not showing?

前端 未结 5 1408
梦毁少年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:39

    You can create a color list

    file location:

    res/color/filename.xml
    

    The filename will be used as the resource ID.

    resource reference:

    In Java: R.color.filename

    In XML: @[package:]color/filename

    syntax:

    
    
        
    
    

    Example:

    XML file saved at res/color/button_text.xml:

    
    
         
         
         
    
    

    This layout XML will apply the color list to a View:

    Refer: Color List Reference

提交回复
热议问题