How to avoid cut/copy/paste in smart phone after r

2020-06-09 07:24发布

I am working on to avoid cut/copy/paste in smart phone (for tablet its fine). Its fine in port mode but coming in land mode EditText shows a Button Next. after selecting the text, next button converts into Edit Button which has copy,cut and paste option.

So is there any way to disable cut/copy after rotation when edit button appears.

i am following this link. How to disable copy/paste from/to EditText

This image with out text select

After select

6条回答
放荡不羁爱自由
2楼-- · 2020-06-09 08:07

Try using these two lines. It may help you:

 EditText.setFocusable(false);
 EditText.setFocusableInTouchMode(false);
查看更多
The star\"
3楼-- · 2020-06-09 08:11

I think you can use this:

http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions

With the flag:

flagNoAccessoryAction

Used in conjunction with a custom action, this indicates that the action should not be available as an accessory button when the input method is full-screen. Note that by setting this flag, there can be cases where the action is simply never available to the user. Setting this generally means that you think showing text being edited is more important than the action you have supplied. Corresponds to IME_FLAG_NO_ACCESSORY_ACTION.

查看更多
三岁会撩人
4楼-- · 2020-06-09 08:15

Try this ..

your_edit_text.setCustomSelectionActionModeCallback(new Callback() {
    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
        return false;
    }

    public void onDestroyActionMode(ActionMode mode) {                  
    }

    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
        return false;
    }

    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
        return false;
    }
});
查看更多
Viruses.
5楼-- · 2020-06-09 08:16

as we don't know what u tried so far..and what you actually doing in your code...beside that..here is a link ...similar to your question , i think this will help you out.. Disabling the fullscreen editing view for soft keyboard input in landscape?

查看更多
劳资没心,怎么记你
6楼-- · 2020-06-09 08:17

I would insist you to disable the long click on the EditText as that Edit button appears when you long press on the selected text in the EditText.

et_text.setLongClickable(false);

Also, you can clear the ClipboardManager, so that if you already have something that is already copied to ClipBoard will be cleared using,

ClipboardManager manager = (ClipboardManager) 
                                 getSystemService(Context.CLIPBOARD_SERVICE);
manager.setText("");
查看更多
Fickle 薄情
7楼-- · 2020-06-09 08:29

@Cobra - set EditText.setEditable(false); in your code, or you set this property in your xml as well. this property done well, but if any case this won't work ..set setFocusable also false.. this solution work for me..

查看更多
登录 后发表回答