what I need to do is have the tab below the action bar, how is this possible? I tried following all the tutorials and even though in the tutorials' screen shots it appears to be below the action bar in my device (a Samsung Galaxy Tab) it appears beside the logo like this:
Here's my code:
public class Yab extends Activity implements ActionBar.TabListener{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
setContentView(R.layout.activity_yab);
RelativeLayout custom = new RelativeLayout(getApplicationContext());
ActionBar.LayoutParams params = new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
custom.setLayoutParams(params);
custom.setGravity(Gravity.CENTER);
ActionBar actionBar = getActionBar();
// add the custom view to the action bar
//actionBar.setCustomView(R.layout.activity_yab);
actionBar.show();
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(custom);
actionBar.setTitle("Trial");
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// For each of the sections in the app, add a tab to the action bar.
actionBar.addTab(actionBar.newTab().setText("add")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("delete")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("view")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("view2")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("view3")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("view4")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("view5")
.setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("view6")
.setTabListener(this));
//actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
// | ActionBar.DISPLAY_SHOW_HOME);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
}
How can I move the position of the tabs to be below the action bar? Any suggestions are really appreciated! Thanks in advance.