How to set drawable size in layer-list

前端 未结 4 1478
暖寄归人
暖寄归人 2021-02-06 22:22

I\'m having problem with setting size of drawable in layer-list. My XML looks like this:



        
4条回答
  •  暖寄归人
    2021-02-06 23:29

    You can use android:width and android:height parameters with desired values.

    Below is the sample drawable layer-list and screen shot. I used the vector drawable from google material icons and own selector drawable.

    Original circle.xml drawable shape have 100dp x 100dp size, but into drawable.xml I override this values to 24dp x 24dp by android:width and android:height parameters.

    I hope this help!

    drawable.xml

    
    
        
        
        
    
    

    circle.xml

    
    
        
            
                
                
            
        
    
    

提交回复
热议问题