Place 3 buttons in a LinearLayout to occupy equal amount of space

前端 未结 9 1617
滥情空心
滥情空心 2021-01-31 14:50

i would like to have three buttons taking equal amount of available space horizontally in a row. I used android:layout_gravity. What is the problem?

layout

9条回答
  •  情话喂你
    2021-01-31 15:34

    besides of setting a layout_weight you have to set layout_width or layout_height to 0dp. So if you want for example to distribute the buttons horizontally , layout_width should be 0dp and layout_weight .2 or any number as long as is equal through the buttons you have.

    so your layout should be like this

    
    
    

提交回复
热议问题