Copy/Paste menu items aren't shown on some devices in Android EditText

505 Views Asked by At

I have a subclass of Android EditText and it' declared as:

    ...
    android:id="@+id/Main.editor"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="left|top"
    android:inputType="textMultiLine|textNoSuggestions|textVisiblePassword"
    android:imeOptions="flagNoExtractUi"
    ...

On most devices user are able to do a long click and see a menu with Copy/Paste items:

In emulator:

enter image description here

On device (where it works):

enter image description here

However on some devices it's not shown on long click:

enter image description here

What can be a reason? I'm thinking about declaring android:longClickable="true" explicitly but i believe it's a default value.

UPDATE: It's reproducible on some Android 9 devices, so it seems to be not that issue: https://issuetracker.google.com/issues/65575880

1

There are 1 best solutions below

2
Mehul Kabaria On

Android has a default feature to show copy/paste menu

Try with this in your xml android:textIsSelectable.

i.e., android:textIsSelectable="true"