There is an activity containing a menu of two items with this code:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_create_order: Intent intent = new Intent(this, OrderActivity.class); startActivity(intent); return true; case R.id.action_settings: return true; default: return super.onOptionsItemSelected(item); } } } And menu markup:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> <item android:id="@+id/action_create_order" android:orderInCategory="1" android:icon="@drawable/ic_action_new_event" android:title="@string/action_create_order" app:showAsAction="ifRoom"/> <item android:id="@+id/action_settings" android:orderInCategory="100" android:title="@string/action_settings" app:showAsAction="never"/> </menu> The com.android.support:v7-25.1.0 dependency is enabled.
The menu should show item with the action_create_order index, as shown in the preview in android studio:
And when you start the application, the icon circled in red goes to the text list of items (the one that opens by pressing three points or the menu button on the phone).
Ps I can not attach more than one picture because recently on stackoverflow, a in order to attach two links, you need at least 10 points of attorney.

app:showAsAction="ifRoom"ifRoom with always - YuriiSPb ♦