I have two ToolBars
in an app, the secondary one that is shown below the main ActionBar
in its totality there are 10 buttons, I want to show as much as the width allows.
The items are defined as ifRoom
, which in principle are all shown in dropmenu
minus one pair.
How do I force the display of the buttons on the toolbar, taking into account the width of the device and whether it is vertical or horizontal.
The load of ToolBars
I do it like this.
private void initToolbars() {
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top);
setSupportActionBar(toolbarTop);
Toolbar toolbarBottom = (Toolbar) findViewById(R.id.toolbar_bottom);
if (toolbarBottom != null) {
//setSupportActionBar(mToolBar);
toolbarBottom.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//process the selected tool
switch (item.getItemId()) {
case R.id.action_firstcase:
return true;
}
return true;
}
});
// Inflate a menu to be displayed in the toolbar
toolbarBottom.inflateMenu(R.menu.tools);
}
}