5
A need to create a menu
with submenu
in action bar
, like this:
Could you help me?
Man XML
menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:apk="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_atualizar"
android:title="@string/menu_atualizar"
apk:showAsAction="ifRoom"
/>
</menu>
My code:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_atualizar:
//código aqui...
default:
return super.onOptionsItemSelected(item);
}
}
I got it, baby (:
– Leonardo