Exception android.content.res.Resources$NotFoundException: File res/drawable/my.xml from drawable resource ID

前端 未结 2 871
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 03:00

Whats wrong with this xml, I am trying to get a button press feel. I am getting a exception, I am unable to understood. ResourceNotFound

In my layout.xm

2条回答
  •  生来不讨喜
    2020-12-31 03:48

    The attribute android:background does not exist. The correct way to do this is to first create a new resource file res/colors.xml with the following contents:

    
    
        #AAAAAA
        #777777
    
    

    Then just change your selector to the following:

    
    
        
        
    
    

    This automatically creates a ColorDrawable and assigns it as the drawable for that state.

提交回复
热议问题