Linear Layout with two buttons side by side - android

后端 未结 3 1628
庸人自扰
庸人自扰 2021-02-13 07:36

I have 3 buttons the layout.xml below where they appear below of each other...

                

        
相关标签:
3条回答
  • 2021-02-13 07:53

    best way to do this is to make layout and then put your button like this code

    <TableRow 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    
     <Button 
        android:id="@+id/Button9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:text="@string/Home1"/>  
    
     <Button 
        android:id="@+id/Button11"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"     
        android:text="@string/NextL"/>
    

    in this shape you have two button in same row so easy :D

    0 讨论(0)
  • 2021-02-13 07:59

    Change the Linear Layout orientation Vertical into Horizontal.And then Give weight for your both buttons as 1 or 2.As your wish.the buttons will be arranged equally.

    0 讨论(0)
  • 2021-02-13 08:08

    just change android:orientation="vertical" to android:orientation="horizontal" of your layout and every thing will work fine

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