How to add padding for background image

后端 未结 4 976
野的像风
野的像风 2021-02-02 08:11

I have a LinearLayout which has a background image (a 9 patched png file). How can I add padding to left and right so that the background image does not take up the

4条回答
  •  一个人的身影
    2021-02-02 08:52

    That doesn't work because padding only acts on the contents of the LinearLayout. By using a second LinearLayout inside this one the padding will take effect. You must define the background color of the first LinearLayout that will be visible in the padding area.

    
    
        
    
        
    
    
    

    Note: This is probably also possible by using an XML file for the background.

提交回复
热议问题