android layout margins with percentage

后端 未结 1 1837
傲寒
傲寒 2021-02-11 15:43

I want to set margins by percentage.. I have 4 imageviews in a linearlayout and want to set default left,right,top,bottom margins that keep same percentage for each screen size.

1条回答
  •  [愿得一人]
    2021-02-11 16:19

    You can have invisible Views in your LinearLayouts as spacers and use the layout_weight mechanism to assign them relative size.

    Example:

    
    
        
    
        
    
        
    
    
    

    0 讨论(0)
提交回复
热议问题