Resource is not a Drawable

前端 未结 5 1783
萌比男神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:06

    I think the best way of doing this is, first create a xml file inside the "drawable" folder and do something like below.

    e.g. light_gray.xml then do something like below.

    
        
            
        
    

    once you have saved it.

    change you code like below.

    
    

    But make sure to put the file light_gray.xml only to "drawable" folder. Do not put the same file to "drawable-hdpi or drawable-hdpi-v4 and so on"

提交回复
热议问题