Android: how to make a view grow to fill available space?

前端 未结 4 1792
清酒与你
清酒与你 2021-01-30 19:27

This seems straightforward, but I can\'t figure out how to do it. I have a horizontal layout with an EditText and two ImageButtons. I want the ImageButtons to be of a fixed si

4条回答
  •  迷失自我
    2021-01-30 20:03

    If you want to keep the layout the same (ie, buttons after the text), use the layout_weight property, along with fill_parent, thus:

    
        
        
        
        
        
        
     
    

    Giving the EditText 'weight' makes it get figured out last and gives precedence to the buttons. Play with the different layout_weights and see how much fun you can have!

提交回复
热议问题