在ImageView
中多次单击时,我想隐藏Listview
。
我确实这样:
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
final int checkedCount = listView.getCheckedItemCount();
mode.setTitle(checkedCount + " Selected");
if(checked) {
imageView.setVisibility(View.INVISIBLE);
} else {
imageView.setVisibility(View.VISIBLE);
}
}
@Override
public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {
return false;
default:
return false;
}
}
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
MenuInflater menuInflater = mode.getMenuInflater();
menuInflater.inflate(R.menu.toolbar_mode, menu);
return true;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
});
但是只有一项是不可见的,我得到了错误。
如果有的话,我有针对ListView
的自定义适配器。谢谢。