title: Stacked ActionBar Tab with Custom View Not Displaying Properly
body: <p>When using action bar tabs, sometimes they are displayed as "stacked" when tab content is too large for the display. A problem arises when I use a custom view for the tab content, it causes the selected tab to not be displayed in the dropdown, and once a tab is selected, the dropdown goes away, and small, empty tabs appear.</p>
  
  <p>Here is a screenshot of the dropdown, before selecting an item: (note that the content of the tab is not displayed, even when the tab is selected)
  <img src="https://i.stack.imgur.com/4lvjR.png" alt="before selecting item"></p>
  
  <p>Also, after selecting the item, the tabs are no longer stacked, and the content of the tabs is empty:
  <img src="https://i.stack.imgur.com/AJ85T.png" alt="after selecting item"></p>
  
  <p>Here is my code, (note that I am using a custom view for the tabs just to demonstrate the problem)</p>
  
  <pre><code>public class ExampleActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          final TextView selectedTabText = new TextView(this);
          setContentView(selectedTabText);
  
          ActionBar.TabListener listener = new ActionBar.TabListener() {
              @Override
              public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
                  TextView customView = (TextView) tab.getCustomView();
                  selectedTabText.setText(customView.getText());
              }
  
              @Override
              public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
  
              }
  
              @Override
              public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
  
              }
          };
  
          ActionBar actionBar = getActionBar();
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
          addTab(actionBar, listener, "Tab one with a very long name");
          addTab(actionBar, listener, "Tab two with a very long name");
          addTab(actionBar, listener, "Tab three with a very long name");
          addTab(actionBar, listener, "Tab four with a very long name");
      }
  
      private void addTab(ActionBar actionBar, ActionBar.TabListener listener, String text) {
          ActionBar.Tab tab = actionBar.newTab();
          TextView textView = new TextView(this);
          textView.setText(text);
          tab.setCustomView(textView);
          tab.setTabListener(listener);
          actionBar.addTab(tab);
      }
  }
  </code></pre>