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

前端 未结 9 1703
滥情空心
滥情空心 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:42

    Please consider the following layout snippet:

    
    
        
    
        
    
        
    
    
    

    2 things to note above.

    A. I created a LinearLayout with weightSum of 3.

    B. Then inside that I create 3 elements each having layout_weight of 1 so that I can have my child elements distribute the entire space among themselves evenly.

提交回复
热议问题