Android Split Action Bar with action elements above and below?

Is there a way to specify some action items at the top of the Split action bar, and the rest at the bottom? Or is it all or nothing, with the result that all elements of the action go only to the bottom of the split?

enter image description here

+56
android android-actionbar android-menu
Dec 20 '11 at 6:50
source share
5 answers

This is currently not possible.

See the answer directly from Android developers Reto Meier and Roman Nurik while working in the Android Developer Office: http://youtu.be/pBmRCBP56-Q?t=55m50s

+25
Dec 22 '11 at 20:05
source share

To solve this problem, I used a custom view as an action bar:

@Override protected 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 panel, I inflated my menu or whatever you want to see below:

  @Override public 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 included (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" > .... 
+17
Dec 05
source share

I solved this problem using CustomView and adding menu items that should be displayed at the top to this view.

+14
Dec 21 2018-11-11T00:
source share

Doubtful. However, you can use them when creating menu items in the action bar for experimentation.

 MenuItem.SHOW_AS_ACTION_ALWAYS MenuItem.SHOW_AS_ACTION_NEVER MenuItem.SHOW_IF_ROOM 
+1
Dec 21 '11 at 1:30
source share

If this option is activated, Android has the ability to split the action bar. Partitioning is determined by the system at runtime.

You can determine that the action bar should be automatically broken by the system, if there is not enough space you can activate it through the android: uiOptions = "SplitActionBarWhenNarrow" parameter in the declaration of activity of your application in the AndroidManifest.xml file.

+1
03 Feb '15 at 7:09
source share



All Articles