title: Two linear layouts in the same line. The first must fill all remaining space
body: <p>I want to put 2 linear layouts in the same line. The second layout of fixed with, but the first must fill all remaining space. In the code below I have marked my changes. But I don´t know how to make the second layout of fixed size so that the first layout fills all the remaining space. Unfortunately, the first layouts now occupies all the space.</p>
  <p><a href="https://i.stack.imgur.com/7k3Sy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7k3Sy.png" alt="Example image" /></a></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;?attr/listPreferredItemHeight&quot;
      android:background=&quot;@drawable/contact_background&quot;
      android:paddingStart=&quot;@dimen/activity_padding&quot;
      android:paddingEnd=&quot;@dimen/activity_padding&quot;
      android:gravity=&quot;center_vertical&quot;&gt;
  
      &lt;RelativeLayout
          android:layout_width=&quot;48sp&quot;
          android:layout_height=&quot;48sp&quot;
          android:layout_marginEnd=&quot;5dp&quot;&gt;
  
          &lt;androidx.appcompat.widget.AppCompatImageView
              android:id=&quot;@+id/avatar&quot;
              android:layout_width=&quot;48sp&quot;
              android:layout_height=&quot;48sp&quot;
              app:srcCompat=&quot;@drawable/ic_person_circle&quot; /&gt;
  
          &lt;ImageView
              android:id=&quot;@+id/online&quot;
              android:layout_width=&quot;16sp&quot;
              android:layout_height=&quot;16sp&quot;
              android:layout_alignParentBottom=&quot;true&quot;
              android:layout_alignParentEnd=&quot;true&quot;
              android:contentDescription=&quot;@string/avatar&quot;
              app:srcCompat=&quot;@drawable/ic_circle&quot;/&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
  
  
          android:orientation=&quot;vertical&quot;&gt;
  
          &lt;LinearLayout
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:orientation=&quot;horizontal&quot;&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/contactName&quot;
                  android:textColor=&quot;#333333&quot;
                  android:textStyle=&quot;bold&quot;
                  android:textSize=&quot;16sp&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_gravity=&quot;start&quot;
                  android:maxLines=&quot;1&quot;
                  android:ellipsize=&quot;end&quot;
                  android:overScrollMode=&quot;never&quot;
                  android:paddingEnd=&quot;16sp&quot;
                  tools:ignore=&quot;RtlSymmetry&quot;
                  tools:text=&quot;Contact title&quot;/&gt;
  
  
              &lt;ImageView
                  android:id=&quot;@+id/icon_muted&quot;
                  android:layout_width=&quot;20dp&quot;
                  android:layout_height=&quot;20dp&quot;
                  android:alpha=&quot;0.75&quot;
                  android:contentDescription=&quot;@string/topic_muted&quot;
                  android:visibility=&quot;gone&quot;
                  app:tint=&quot;@color/colorGray&quot;
                  app:srcCompat=&quot;@drawable/ic_notifications_off&quot;/&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/icon_blocked&quot;
                  android:layout_width=&quot;20dp&quot;
                  android:layout_height=&quot;20dp&quot;
                  android:alpha=&quot;0.75&quot;
                  android:contentDescription=&quot;@string/topic_blocked&quot;
                  android:visibility=&quot;gone&quot;
                  app:tint=&quot;@color/colorGray&quot;
                  app:srcCompat=&quot;@drawable/ic_block&quot;/&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/icon_archived&quot;
                  android:layout_width=&quot;20dp&quot;
                  android:layout_height=&quot;20dp&quot;
                  android:alpha=&quot;0.75&quot;
                  android:contentDescription=&quot;@string/topic_archived&quot;
                  android:visibility=&quot;gone&quot;
                  app:tint=&quot;@color/colorGray&quot;
                  app:srcCompat=&quot;@drawable/ic_filecab&quot;/&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;TextView android:id=&quot;@+id/contactPriv&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_gravity=&quot;top&quot;
              android:ellipsize=&quot;end&quot;
              android:overScrollMode=&quot;never&quot;
              android:maxLines=&quot;1&quot;
              android:maxWidth=&quot;240sp&quot;
              android:text=&quot;&quot;
              android:textAppearance=&quot;?android:textAppearanceSmall&quot;
              tools:text=&quot;Contact private: Lorem ipsum dolor sit amet, consectetur adipiscing elit&quot; /&gt;
  
  
      &lt;/LinearLayout&gt;
  
  
      &lt;!-- This is what I added to achieve the result - start --&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;38sp&quot;
          android:layout_height=&quot;38sp&quot;
          &gt;
  
          &lt;TextView
              android:id=&quot;@+id/unreadCountt&quot;
              android:layout_width=&quot;38dp&quot;
              android:layout_height=&quot;38dp&quot;
              android:layout_gravity=&quot;end|center_vertical&quot;
              android:background=&quot;@drawable/pill_counter&quot;
              android:gravity=&quot;center&quot;
              android:padding=&quot;3dp&quot;
              android:textColor=&quot;@color/white&quot;
              android:textSize=&quot;16sp&quot;
              android:textStyle=&quot;bold&quot;
              tools:ignore=&quot;SmallSp&quot;
              tools:text=&quot;9+&quot; /&gt;
      &lt;/LinearLayout&gt;
  
  
      &lt;!-- This is what I added to achieve the result - end --&gt;
      
  &lt;/LinearLayout&gt;
  </code></pre>