Android Split Action Bar with Action Items on the top and bottom? Android Split Action Bar with Action Items on the top and bottom? android android

Android Split Action Bar with Action Items on the top and bottom?


This is currently not possible.

See the response directly from Android developers Reto Meier and Roman Nurik during the Android Developer Office Hours:http://youtu.be/pBmRCBP56-Q?t=55m50s


To solve this I used a custom view as my action bar:

@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.main);    ActionBar actionBar = getActionBar();    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);    View view = View.inflate(getApplicationContext(), R.layout.actionbar,            null);    actionBar.setCustomView(view);}

and then for the bottom bar I inflated my menu view or whatever you want to appear at bottom:

 @Overridepublic boolean onCreateOptionsMenu(Menu menu) {    getMenuInflater().inflate(R.menu.browser_main, menu);    RelativeLayout relativeLayout = (RelativeLayout) menu.findItem(            R.id.layout_item).getActionView();    View inflatedView = getLayoutInflater().inflate(            R.layout.media_bottombar, null);    relativeLayout.addView(inflatedView);    return true;}

In the Android Manifest, I also include (android:uiOptions="splitActionBarWhenNarrow") like this:

<application    android:allowBackup="true"    android:icon="@drawable/ic_launcher"    android:label="@string/app_name"    android:theme="@style/AppTheme"    android:uiOptions="splitActionBarWhenNarrow" > ....


I solved this problem by using a CustomView and adding the menu items, which should display at the top, to this view.