How to show copy-paste options (Context menu) for MultiAutoCompleteTextView on button click?

喜你入骨 提交于 2019-12-23 20:19:19

问题


I am trying to show context menu (copy-paste options) for MultiAutoCompleteTextView when clicked on button. Here is what I have tried but did not work.

mButton.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            // the below line didn't work either.
            //mAutoCompleteTextView.showContextMenu();
            mAutoCompleteTextView.performLongClick();
            return true;
        }
    });

Is there any way to show context menu? Menu is shown when I long press MultiAutoCompleteTextView, but I need to achieve same functionality when long clicked on any other view on the activity.

来源:https://stackoverflow.com/questions/47195345/how-to-show-copy-paste-options-context-menu-for-multiautocompletetextview-on-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!