T
T
TeslaE2017-09-28 19:55:26
Java
TeslaE, 2017-09-28 19:55:26

Android studio OptionsMenu how to make the menu not close after selecting an Item?

How to make it so that after selecting a menu item it does not close? (After clicking, the choice or the like would simply be highlighted).
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.app_bar_switch:
item.setChecked(!item.isChecked());
if (item.isChecked()){}
else {}
break;
default:
return true;}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question