Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Force collapse of tabs in ActionBar
  2. public class AdminActivity extends SherlockFragmentActivity {
  3.  
  4. @Override
  5. protected void onCreate(Bundle savedInstanceState) {
  6.     super.onCreate(savedInstanceState);
  7.     setContentView(R.layout.activity_admin);
  8.  
  9.     ActionBar actionBar = getSupportActionBar();
  10.     actionBar.setDisplayHomeAsUpEnabled(true);
  11.     actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  12.  
  13.     ActionBar.Tab itemsTab = actionBar.newTab().setText(R.string.label_tab_items);
  14.     ActionBar.Tab usersTab = actionBar.newTab().setText(R.string.label_tab_users);
  15.  
  16.     actionBar.addTab(itemsTab);
  17.     actionBar.addTab(usersTab);
  18. }