Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid layout_weight squeezing an view too thin
    primarykey
    data
    text
    <p>I can't seem to figure out how to effectively use android's layout_weight attribute. I'm trying to create a custom listView that has three textView's. The primary textView resides at the top left, then i have a text view that resides in the top right for, and then the third one that lives underneath the primary textView. I'd like the primary and the top right two be on the some horizontal axis but i want the primary textView to take up about 70% of the width, while the other textView takes the remaining 30%. No matter what weight i assign to the primary and right textView, the primary textView is always larger and squeezes the right data textView wayyy too thin. </p> <p><img src="https://i.stack.imgur.com/gA5ot.jpg" alt="enter image description here"></p> <p>My code:</p> <p> </p> <pre><code>&lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dip" android:id="@+id/Llayout"&gt; &lt;!-- Title--&gt; &lt;TextView android:id="@+id/primaryTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Loading some tadglkj dgjg sadlgkj dgksgj sgj sdgk" android:textColor="#040404" android:typeface="sans" android:textSize="18dip" android:textStyle="bold" android:paddingTop="0dp" android:background="#888" android:layout_weight="4"/&gt; &lt;!-- Right Data --&gt; &lt;TextView android:id="@+id/rightData" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="10" android:layout_marginRight="5dip" android:textSize="12dip" android:textColor="#B53021" android:textStyle="bold" android:background="#bada55" android:text="1.3 mi"/&gt; &lt;/LinearLayout&gt; &lt;!-- Secondary title --&gt; &lt;TextView android:id="@+id/secondaryTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#343434" android:textSize="12dip" android:layout_marginTop="1dip" android:text="hello this is some other data"/&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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