I have an action bar with a custom layout that seems to be interfering with how the tabs should layout. I think the problem is that since I'm using a custom view for the action bar when I try to add tabs it wants to put them "in" the action bar instead of below the action bar because of the custom layout. I want the tabs to be below like the would be if I used a regular menu in the action bar.
LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflator.inflate(R.layout.menu_default, null);
ActionBar actionBar = getActionBar();
actionBar.setCustomView(v);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Tab t = actionBar.newTab();
t.setText("tab1");
t.setTabListener(new TabListener() {
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
});
actionBar.addTab(t);
Tab t2 = actionBar.newTab();
t2.setText("tab2");
t2.setTabListener(new TabListener() {
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
});
actionBar.addTab(t2);