Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get proper layout with "fill_parent"
    text
    copied!<p>I'm trying to create this simple layout in Android. </p> <p><img src="https://i.stack.imgur.com/xtpU9.png" alt="enter image description here"></p> <p><strong>A</strong> should wrap to fit its content and <code>left|center_vertical</code> align.</p> <p><strong>B</strong> should expand as much as possible, filling all empty space.</p> <p><strong>C</strong> should be right-aligned, wrapping to fill its content and also being aligned <code>center_vertical</code>. </p> <p>Here is my layout:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="left|center_vertical"&gt; &lt;!-- A --&gt; &lt;ImageView android:id="@+id/example_item_icon" android:layout_width="48px" android:layout_height="48px"/&gt; &lt;!-- B --&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="left|center_vertical" android:padding="5px"&gt; &lt;TextView android:id="@+id/example_item_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold"/&gt; &lt;TextView android:id="@+id/example_item_level_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold|italic" android:lines="1" android:textSize="10px"/&gt; &lt;/LinearLayout&gt; &lt;!-- C --&gt; &lt;TextView android:id="@+id/example_item_count_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:textSize="14px"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>In this layout, <strong>C</strong> is pushed off-screen. How can I make this layout work? </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