删除文本选择上下文操作栏

时间:2017-03-27 09:47:29

标签: android textview

我在用户选择文字时显示PopupWindow,并在onPrepareActionMode清除菜单中setCustomSelectionActionModeCallback显示:

 menu.clear();

但是在android lollipop中显示一个工具栏时选择一个文本: image of my toolbar and contextual action bar

我wnat隐藏文本选择上下文操作栏。

        final TextView bodyView = (TextView) findViewById(R.id.txt);

    bodyView.setCustomSelectionActionModeCallback(new AbsListView.MultiChoiceModeListener() {
        @Override
        public void onItemCheckedStateChanged(ActionMode actionMode, int i, long l, boolean b) {
        }

        public boolean onCreateActionMode(ActionMode mode, Menu menu) {

            return true;
        }

        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            menu.clear();
            showcustomDialog(bodyView);
            return false;
        }

        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return false;
        }

        public void onDestroyActionMode(ActionMode mode) {
        }
    });

0 个答案:

没有答案