How have Control on onCreateActionMode

Home / Uncategorized / How have Control on onCreateActionMode

Question:
I have RecyclerView in the Application. I set a context menu for this RecyclerView. This menu will display to the user when does on long click action on RecyclerView items.
// Multi select items in RecyclerView
private android.support.v7.view.ActionMode.Callback mDeleteMode = new ModalMultiSelectorCallback(mMultiSelector) {

@Override
public boolean onCreateActionMode(android.support.v7.view.ActionMode actionMode, Menu menu) {
getMenuInflater().inflate(R.menu.menu_add_reminder, menu);
return true;
}

@Override
public boolean onActionItemClicked(android.support.v7.view.ActionMode actionMode, MenuItem menuItem) {

switch (menuItem.getItemId()) {

// On clicking discard reminders
case R.id.discard_reminder:
// Close the context menu
actionMode.finish();
return true;

// On clicking save reminders
case R.id.save_reminder:
// Close the context menu
actionMode.finish();
…..
return true;

case android.R.id.home:
// Close the context menu
actionMode.finish();
return true;

default:break;
}
return false;
}
};

In my menu I have a white arrow in left side of menu like below(It’s hard to see because of white background):
[![white arrow in menu][1]][1]

First, I tried to remove this arrow with this codes:getSupportActionBar().setDisplayHomeAsUpEnabled(false);

Then I tried to have control on its behavior with this:case android.R.id.home:
But they didn’t work for me. Thank you for your help.


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *