Resource is not a Drawable

前端 未结 5 1731
萌比男神i
萌比男神i 2021-01-16 13:23

This code causes force close exception on Emulator(API 18) and works in ASUS Nexus 7(API 21)



        
5条回答
  •  清酒与你
    2021-01-16 14:11

    Your color resource must reside in an Android resource file (i.e.: in the colors.xml file).
    Android would not complain where you set it, but it must be defined as a color resource.

    I.e.:

    #ebebeb
    

    [EDIT]

    The names appear not to match...
    See this line:

    android:background="@drawable/login_btn_selector"
    

    Then you say: So I tried to place the login_btn_selected.xml.

    It seems to be the cause of

    Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi-v4/login_btn_selected.xml from drawable resource ID #0x7f020095.
    

提交回复
热议问题