Is it possible to add any element to the context menus of the android (system menu)

When I enter some text and press and hold it, the context menu is represented by such items as cutting, copying, selecting text, etc.

Is there any way to add my own custom element to this context menu? I don’t understand how this works, but I think it should be possible to register something in the manifest in the same way as registering actions and broadcasts.,.

Thanks,

Any ideas are welcome

enter image description here

+6
source share
2 answers

Can I add my own item to this context menu?

Only for widgets in your own actions, and not for the system as a whole.

In addition, EditText problematic even for your own actions, as some device manufacturers bypass the regular context menu system, so you cannot add to them.

In this case, for your own actions, just follow the instructions to create a context menu for the widgets of interest.

+3
source

Have you tried putting onLongClickListener in your EditText? This will not allow you to add to the current list, but you can make your own dialog box, and then add all the options above or some of them or none of them and your own.

I'm not sure that exactly what you are asking is possible, and if this is my way, this is a little more work, but you will have full control.

+1
source

Source: https://habr.com/ru/post/900519/


All Articles