Android tutorial - Android Context Menu - android app development - android studio - android development tutorial
Learn android - android tutorial - Android context menu - android examples - android programs
What is android context menu?
- It can be seen in Android main screen, when you long press/click the screen it will get activated. Android context menu is similar to context menu in Windows or Linux, the one which is displayed on right click.
- Now let’s see an example to create Context menu in Android.
- Android context menu appears when user press long click on the element. It is also known as floating menu.
- It doesn't support item shortcuts and icons.
Android Context Menu Example
- Let's see the simple example of context menu in android.
- Drag one listview from the pallete, now the xml file will look like this:
- File: activity_main.xml
- Let's write the code to display the context menu on press of the listview.
- File: MainActivity.java
- download this android example
- Output after long press on the listview.
- Output after clicking on the context menu.