Android Drawable: Specifying shape width in percent in the XML file?

前端 未结 5 1500
攒了一身酷
攒了一身酷 2020-12-06 04:06

I\'m trying to create a simple Drawable that I want to set as the background for a view (using setBackgroundDrawable). I simply want to divide the background of the

5条回答
  •  攒了一身酷
    2020-12-06 04:58

    The best way as swapnil stated, is to use layout_weight in a LinearLayout. If you're going horizontally, set layout_width to "fill_parent" then set the layout_weight to a percentage that you want. Start with something like below and play around with the layout_width values to get a feel of it (or add more Views just to get a better understanding).

    
    
        
        
    
    

提交回复
热议问题