I try to enable the copying of content from an Android EditText in the clipboard but it works. Curiously, with a prolonged pressure on the screen one (1) cursor appears and not two cursors as it should and neither do I have the copy and paste options (which in my phone is a top bar)
I use AppCompat with API 16 and I am testing on an Android 4.1.2 phone (JELLY_BEAN)
- I've made my ActionBar visible again just in case.
-
I have checked for the presence of the cursor by pressing that:
- The longpress is enabled
- The EditText is focusableInTouch
-
The problem is independent of whether or not the virtual keyboard is hidden.
I would like to avoid trying out answers of the type try this and that since there are many possible combinations a priori like:
android:inputType= text / none
android:textIsSelectable = true / false
android:focusableInTouchMode = true / false
android: enabled / disabled
etc
Thankful from now!
EDIT :
Isolating the error was not easy, so I created a new project and verified that as Piero mentions in his response-comment there is something that "blocks" the functionality and it was like this:
AutoResizeEditText res_display = findViewById(R.id.resDisplay);
res_display.setText("");
res_display.setEnabled(true);
res_display.setFocusableInTouchMode(true);
res_display.setFocusable(true);
res_display.setEnableSizeCache(false);
res_display.setMovementMethod(null);
// can be added after layout inflation; it doesn't have to be fixed
// value
res_display.setMaxHeight(330); // algún valor
These lines represent a patch of the author of an EditText with auto-adjustable text in font size:
The problem is that now the two cursors appear but the bar quickly disappears with the buttons [copy] and [paste] so the problem remains unresolved.