Reputation: 1586
I have an activity with swipable tabs with three fragments. The first fragment is a ListView. I need to display the action mode when long clicking the list item. And the following code works fine. But when i click the action items, onActionItemClicked never gets called, instead view behind the actionView (The tabs) is getting clicked.
Here is the screenshot of action mode, you can see the menu items is mixed with the background views (tabs) The text "FOLDERS" is actually behind the acionview.
This is what i get on other devices Here is my ActionMode.Callback
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
// called when the action mode is created; startActionMode() was called
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
// Inflate a menu resource providing context menu items
MenuInflater inflater = mode.getMenuInflater();
// assumes that you have "contexual.xml" menu resources
inflater.inflate(R.menu.actions, menu);
return true;
}
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false; // Return false if nothing is done
}
// called when the user selects a contextual menu item
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
debug("onActionItemClicked");
mode.finish();
return false;
}
// called when the user exits the action mode
public void onDestroyActionMode(ActionMode mode) {
debug("onDestroyActionMode");
}
};
and the item longClick listener
list.setOnItemLongClickListener(new OnItemLongClickListener(){
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mActionMode = getActivity()
.startActionMode(mActionModeCallback);
return true;
}
});
This problem is only on nexus 5 with android L in portrait mode. It works on other devices and on landscape mode on nexus 5. I don't know what to do. anyone please help me...
Upvotes: 0
Views: 1660
Reputation: 2402
It's a known bug. Apart from the issue, you filed, there is also [issue 673](https://code.google.com/p/android-developer-preview/issues/detail?id=673].
The latter one has already been passed on to Google's development team.
Upvotes: 1