Note that there are some explanatory texts on larger screens.

plurals
  1. POSet textview and 2 buttons in a android layout
    text
    copied!<p>Im trying to set one textview aligned on the left and two bottons aligned on the right as in the image. I'm using margins but I guess this is not the best solution and it'll change in different phones, anyway my second button doesn't appear in the app. This is the xml code I have:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#807E7B"&gt; &lt;TextView android:id="@+id/txtForum" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textStyle="bold" android:textSize="25dp" android:textColor="#255094" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" &gt; &lt;/TextView&gt; &lt;Button android:id="@+id/btnBack" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="New Thread" android:layout_marginLeft="80dp" android:layout_marginBottom="5dp"&gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnBrowser" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="Browser" android:layout_marginLeft="100dp" android:layout_marginBottom="5dp"&gt; &lt;/Button&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:cacheColorHint="#00000000"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>This is what I expected:</p> <p><img src="https://i.stack.imgur.com/epNe0.png" alt="http://i47.tinypic.com/jheq1k.png"></p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload