I would like to create a menu to appear on the screen when the Menu button is pressed.I've implemented it and it appears in the bottom of the page but not the one i would like... Hereunder my code and my goal picture to achieve
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.collapseall:
// Single menu item is selected do something
collapseAll();
return true;
case R.id.expandall:
expandAll();
return true;
}
}
My desired Menu:
My current Menu:
Edit:
main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/expandall"
android:orderInCategory="100"
android:showAsAction="always"
android:title="Expand All"/>
<item
android:id="@+id/collapseall"
android:orderInCategory="100"
android:showAsAction="withText"
android:title="Collapse All"/>
<item
android:id="@+id/myprofile"
android:orderInCategory="100"
android:showAsAction="withText"
android:title="My Profile"/>
<item
android:id="@+id/signout"
android:orderInCategory="100"
android:showAsAction="always"
android:title="Sign Out"/>
</menu>