ActionBarSherlock static attachment menu

actionbarsherlock, android

Solution

Use `splitActionBarWhenNarrow` option in `AndroidManifest.xml`:

<activity android:name=".YourActivity" android:uiOptions="splitActionBarWhenNarrow" />

Override `onCreateOptionsMenu` as following:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    final MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.activity_home, menu);

    return super.onCreateOptionsMenu(menu);
}

Problem

I want to have a toolbar-like menu at the bottom of an activity, and I'm using ActionBarSherlock in my app, and I found the "Static attachment"-demo that adds a "toolbar" at the bottom... So I've tried to implement this like below: ``` public class ReadMailInbox extends Activity implements OnCreateOptionsMenuListener { ActionBarSherlock mSherlock = ActionBarSherlock.wrap(this); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSherlock.setContentView(R.layout.readmessage_layout); } @Override public boolean onCreateOptionsMenu(android.view.Menu menu) { return mSherlock.dispatchCreateOptionsMenu(menu); } @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Refresh") .setIcon(android.R.drawable.ic_menu_rotate) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true; } } ``` But it appears at the top of the view instead of at the bottom... Additionally, I would like to use an xml layout for the menu, instead of adding each menu button, since I want to use this for several activities... So how I can get it to show at the bottom instead???

Original source