android - ListView: hide Contextual Action Bar -
i'm following official guide using contextual action mode this:
listview.setchoicemode(abslistview.choice_mode_multiple_modal); listview.setmultichoicemodelistener(new abslistview.multichoicemodelistener() { @override public void onitemcheckedstatechanged(actionmode mode, int position, long id, boolean checked) { } @override public boolean oncreateactionmode(actionmode mode, menu menu) { menuinflater inflater = mode.getmenuinflater(); inflater.inflate(r.menu.shelf_context, menu); return true; } @override public boolean onprepareactionmode(actionmode mode, menu menu) { return true; } @override public boolean onactionitemclicked(actionmode mode, menuitem item) { // processing... return true; } @override public void ondestroyactionmode(actionmode mode) { } });
my listview inside fragment
inside viewpager
, want hide contextual action bar when fragment becomes invisible. how do that? call listview.clearchoices()
clear selection, cab still visible:
@override public void setuservisiblehint(boolean isvisibletouser) { super.setuservisiblehint(isvisibletouser); if (!isvisibletouser) { listview.clearchoices(); // cab still visible. } }
mode.finish()
isn't working?
case r.id.action_remove: mode.finish();
Comments
Post a Comment