tag requires a 'drawable' attribute

前端 未结 3 1554
渐次进展
渐次进展 2021-02-09 01:30

I am trying to very simply style a Button. I just want it blue with with text when not pressed, and white with blue text when clicked.

I tried to do this w

3条回答
  •  再見小時候
    2021-02-09 02:09

    • Background attribute expects a drawable and the drawable selector must be in one of the /drawable folders.
    • TextColor attribute expects a color and the color selector must be in one of the /color folders.
    /res/color/my_textcolor_selctor.xml
    /res/drawable/my_background_selector.xml
    

    Also, the drawable selector must use 'android:drawable' for selector items (a color resource maybe used for the attribute value since a color is a drawable), whereas the color selector must use 'android:color' for the selector items.

    
    
        
        
        
    

    
    
        
        
        
    

提交回复
热议问题