The realization method of android-context menu (menu bound control)

To see such an effect, you can set it through the menu
Insert picture description here
. 1. In the xml file, just add a control, here I give him a most common text.
Insert picture description here
2. Create a menu folder and create a menu resource file
Insert picture description here
Insert picture description here
3. In the main file Get the text control and give it a context menu.
Insert picture description here
4. Create a menu context menu.
Insert picture description here
5. Realize item click events.
Insert picture description here
6. The effect is as follows
Insert picture description here

Guess you like

Origin blog.csdn.net/Willow_Spring/article/details/112922454