Linear Layout with two buttons side by side - android

后端 未结 3 1136
温柔的废话
温柔的废话 2021-02-13 07:30

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

                

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

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

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

    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 08:05

    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)
提交回复
热议问题