Menu operation for Android

Source: Internet
Author: User

First two episodes are explained in two ways


One is implemented in code, and the other is implemented using XML files.

And then the listener is the same. Directly use the item's ID to trigger the menu directly.


Finally, the second episode directly adds the menu directly inside the action bar.


The third episode explains the use of floating menus

A floating menu can be registered with any view.

And every menu item is monitored.


About the differences (the following is the addition of the context menu)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4B/78/wKiom1QuCFqzyhnxAAHMuDxz9Ac982.jpg "title=" Snapshot 30.jpg "alt=" Wkiom1qucfqzyhnxaahmudxz9ac982.jpg "/>

This menu will appear directly when you click on an item in the ListView.


The following method will trigger this method when you click on a project in the ListView.


The following directly triggers the practice of clicking on each small item in the context menu

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4B/7A/wKioL1QuCZXAm4YtAAMn9L3cOUw726.jpg "title=" Snapshot 32.jpg "alt=" Wkiol1quczxam4ytaamn9l3couw726.jpg "/>


Finally, the context popup menu is written



Look at the code:



Menu operation for Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.