Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: ActionBar tabs showing beside logo, not below it
    primarykey
    data
    text
    <p>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: </p> <p><img src="https://i.stack.imgur.com/MyC1P.jpg" alt="enter image description here"></p> <p>Here's my code:</p> <pre><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; } } </code></pre> <p>How can I move the position of the tabs to be below the action bar? Any suggestions are really appreciated! Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload