title: Have view wrap content, but match parent if space is available
body: <p>I have two views within a <code>LinearLayout</code>, both of which should <code>wrap_content</code> such that they are minimally large enough to display their content. The <code>LinearLayout</code> view group should <code>wrap_content</code> of the two child groups such that it is just large enough to display the content of both child views.</p>
  
  <p>But after this, if one of the two child views is larger, the other child view should expand to match parent to fill the remaining space available to it. The content of the two child views is dynamic and is unknown which will be larger at runtime.</p>
  
  <p>The two child views are a <code>TextView</code> and a <code>Spinner</code>. The <code>Spinner</code> should fill any remaining space in the <code>LinearLayout</code> width. But if I change the <code>Spinner</code> <code>layout_width</code> to <code>match_parent</code> and the <code>TextView</code> is not large enough, the <code>Spinner</code> will truncate its contents.</p>
  
  <p>Basically I need a way to choose the maximum width between <code>wrap_content</code> and <code>match_parent</code>.</p>
  
  <p>This is the layout:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/parentView"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:id="@+id/label"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="-2dp"
          android:layout_marginBottom="-2dp"
          android:paddingStart="4dp"
          android:paddingEnd="4dp"
          android:textSize="12sp"
          android:textColor="?android:textColorHint"
          tools:text="Label" /&gt;
  
      &lt;Spinner
          android:id="@+id/spinner"
          style="@style/Widget.AppCompat.Spinner.Underlined"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  &lt;!-- or android:layout_width="match_parent"? need max of both... --&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>