Note that there are some explanatory texts on larger screens.

plurals
  1. POLinearLayout space distribution with image,text and image
    primarykey
    data
    text
    <p>I have a linearlayout with 2 image views and a text view. I want proper space distribution within the layout row. It should be somethink like below</p> <pre><code>______________________________ |IV| |IV| | | &lt;-- Text View -----&gt; | | _______________________________ </code></pre> <p>How can I achieve this? I want all the space assigned to textview after fitting the two images.</p> <p>Below is my attempt and its not working.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout android:orientation="horizontal" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_below="@+id/addTrip" android:layout_weight="1" android:layout_height="wrap_content"&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:src="@drawable/icon" /&gt; &lt;TextView android:layout_weight="1" android:id="@+id/textView1" android:clickable="true" android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="right" android:text="Enter trip name"&gt;&lt;/TextView&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_gravity="right" android:src="@drawable/edit" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/ImageView&gt; &lt;/LinearLayout&gt; </code></pre> <p>I am using this as Layout inflater.</p> <pre><code> ArrayList&lt;TripInfo&gt; trips = inst.getListOfTrips(); //reading from DB for (int i =0; i &lt; trips.size(); i++) { TripInfo tobj = trips.get(i); LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout lrow = (LinearLayout)vi.inflate(R.layout.triprow, null); ((TextView)lrow.getChildAt(1)).setText(tobj.getName()); placeHolderLinearLayout.addView(lrow); } </code></pre> <p>Experts please provide some input. Do I have to set anything in the code as well.</p>
    singulars
    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.
    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