I want to create tabbed ActionBar (NAVIGATION_MODE_TABS) with custom view (DISPLAY_SHOW_CUSTOM). It should looks like this:
The buttons in the top row have to be added as optionMenu items:
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
for (int i = 0; i < menuItems; i++)
{
if (i == 0)
{
menu.add(R.string.home).setIcon(R.drawable.button_home).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.getItem(0).setOnMenuItemClickListener(this);
}
}
return super.onCreateOptionsMenu(menu);
}
The philosophy of the ActionBar is slightly different then I supposed to be when asking. From the Android developer guide:
When you want to provide navigation tabs in an activity, using the action bar's tabs is a great option (instead of using TabWidget), because the system adapts the action bar tabs for different screen sizes—placing them in the main action bar when the screen is sufficiently wide, or in a separate bar (known as the "stacked action bar") when the screen is too narrow.