title: Autoresizing of text in Android
body: <p>In iOS there is a notion of UIView's being able to resize themselves based on constraints given by the parent View. For example, if the parent View enlarges itself, then the child Views might expand or shrink to fit the available space. This is built in to the platform and makes development trivial.</p>
  
  <p>So, my problem is that I am developing a smartphone application that makes use of the ActionBar in ICS. I have a custom view in there that I set using:</p>
  
  <pre><code>actionBar.setCustomView(R.layout.my_custom_title);
  </code></pre>
  
  <p>Note that I'm just inflating a view from the xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  &lt;TextView
      android:id="@+id/title"
      style="@style/TextAppearance.Title.Theme"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:ellipsize="end"
      android:scrollHorizontally="true"
      android:singleLine="true"
      android:text="Title" /&gt;
  &lt;TextView
      android:id="@+id/subtitle"
      style="@style/TextAppearance.SubTitle.Theme"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:ellipsize="end"
      android:scrollHorizontally="true"
      android:singleLine="true"
      android:text="Subtitle" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Now, in ICS, the ActionBar changes its height during an orientation change. It is narrower in landscape mode than in portrait mode. This causes my "subtitle" text to be cut off in landscape mode since the height of the ActionBar has shrunk, while my custom title view text has not resized itself.</p>
  
  <p>Is it possible to resize the text on orientation change without programmatically doing so?</p>
  
  <p>I'm overring</p>
  
  <pre><code>onConfigurationChanged()
  </code></pre>
  
  <p>so I can't just have a separate landscape and portrait custom title view.</p>
  
  <p>SIDE NOTE:
  This reminds me... I wish in the onConfigurationChanged() we can just supply a new xml layout that basically just adjusts the positioning of the views on the screen. The portrait and xml layouts would have to contain the same views of course, but there would be different layout information. This would make life much easier and would be more efficient than having onCreate() called again.</p>