How to show copy-paste options (Context menu) for

2019-07-17 08:09发布

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.

0条回答
登录 后发表回答