setCustomSelectionActionModeCallback无法使用我的editText :(

时间:2016-09-14 00:01:02

标签: android android-edittext textview custom-controls

在我的editText上,当我执行setCustomSelectionActionModeCallback(new Callback(){})时,从不调用Callback :(我认为edittext上的所有内容都配置得很好,我做

  • settextIsSelectable(真);
  • setfocusable(真);
  • setfocusableInTouchMode(真);
  • setlongClickable(真);

我的editText中有什么可以禁止回调?如何为我的edittext构建自定义上下文菜单?

这是我的代码:

this.setCustomSelectionActionModeCallback(new Callback() {

    @Override
    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
        Log.e("onPrepareActionMode","onPrepareActionMode");
        return true;
    }

    @Override
    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
        Log.e("onCreateActionMode","onCreateActionMode");
        return true;
    }

    @Override
    public void onDestroyActionMode(ActionMode mode) {
        Log.e("onDestroyActionMode","onDestroyActionMode");
    }

    @Override
    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    Log.e("onActionItemClicked","onActionItemClicked");
    return true;
    }

});

0 个答案:

没有答案