Creating a settings menu on Android

I am trying to make an options menu in android like this link http://developer.android.com/guide/topics/ui/menus.html#options-menu

but my developed menu is not displayed at the bottom of my page, but in the top action bar.

my xml is below: my_options_menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/new_game" android:icon="@drawable/menu_addnew" android:title="Νέο" android:showAsAction="ifRoom"/> <item android:id="@+id/help" android:icon="@drawable/menu_addnew" android:title="Βοήθεια" /> </menu> 

and my java code

  @Override public boolean onCreateOptionsMenu(Menu menu){ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.my_options_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.new_game: //newGame(); return true; case R.id.help: //showHelp(); return true; default: return super.onOptionsItemSelected(item); } } 

What can I do to show the menu at the bottom of my application, and not on the top action bar?

My menu is shown below. enter image description here

I want to create a menu as shown below.

enter image description here

How can I do that? Can anybody help me?

+6
source share
4 answers

This page should answer all your questions: http://developer.android.com/guide/topics/ui/actionbar.html in the section "Using the dividing action bar" should be all the information needed to add menu items at the bottom of the page

+1
source

Change the target Sdk level to 10 or lower .

You seem to be using a Jelly bean, where the default menu option is on top.

The menu you specified is a Gingerbread style menu.

or try

set the theme of activity Theme.Holo.NoActionBar

Right click on your project> properties> select "Android"> "Right side", you can choose your goal

or change minSdkversion and target from Android manifest file

+1
source

add the following line after onCreat.

  super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.home_screen); 
+1
source

The reason this is shown in the action menu is because you have android:showAsAction="ifRoom" in your XML file. remove it and you have to be good.

+1
source

Source: https://habr.com/ru/post/953863/


All Articles