1

I notice that when highlighting text in a WebView a share button appears along with the standard copy and select all buttons:

WebView text selected

but when highlighting text in a TextView or EditText, there is no such button.

EditText text selected

Is there any way to add such a button via XML or can it be done programmatically?

yuttadhammo
  • 5,069
  • 6
  • 34
  • 45

1 Answers1

5

You can achieve that by setting a custom selection action mode using

TextView.setCustomSelectionActionModeCallback(ActionMode.Callback)

and so the EditText

Here's a similar question with that was answered with an example

Also visit TextView.html#setCustomSelectionActionModeCallback

Community
  • 1
  • 1