title: how to set view width from font width
body: <p>I have an EditText and a Spinner in a horizontal layout.  I'd like the spinner to be only as large as necessary to hold its widest text and the EditText to take the remaining space.  Is there an easy way to do this?</p>
  
  <p>For example, ideally, I'd like to specify the spinner's width as some multiple of the average font width, declared as an attribute in the xml file.</p>
  
  <p>Otherwise, I suppose I need to do something at runtime such as get the text width of each item in the spinner and take the max + some allowance for the radio-button icon.</p>
  
  <p>This is my xml:</p>
  
  <pre><code>&lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" &gt;
  
    &lt;EditText
      android:id="@+id/text"
      android:layout_weight="1"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="@string/text" /&gt;
  
    &lt;Spinner
      android:id="@+id/type"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:spinnerMode="dropdown"
      android:textAppearance="@android:style/TextAppearance.Medium" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Thanks.</p>