The Options menu above and below the android3.0 and the following versions show the refresh principle, refresh the adaptation

Source: Internet
Author: User

One shows the difference:

2.3.x and the following version, you need to press the menu key to display the menu, when the menu opens, the first visible part is the icon menu, up to 6 menu items can be accommodated. If your menu includes more than 6 items on Android, sixth, the rest will be grouped under the "More" menu; 3.0 or later, gradually discard the 2.3.x and the following version of the menu this style, the main push action Bar, and when the menu opens, will display all menu items.

The difference between menu creation and operation

1> in 2.3.x and below, when the menu is open, the system call: Oncreateoptionmenu () method creates a menu instance. For more than 3.0 versions, the app starts with the Invoke: Oncreateoptionmenu () method to create the menu instance.

2> in versions 2.3.x and below, when the menu instance is created, it is called the Onprepareoptionsmenu () method each time it is pressed. 3.0 and later, not each press the menu key Onprepareoptionsmenu () method will be called, another 3.0 and later, the new: Invalidateoptionsmenu () method, Need to call manually: Invalidateoptionsmenu () method, then the system will go to call: Oncreateoptionmenu,onprepareoptionmenu () method, and then go to press the menu key, The Onprepareoptionmenu () method is no longer called.

If you are using a V7support package to refresh the menu at both the lower and the higher versions

Supportinvalidateoptionsmenu ();

The Options menu above and below the android3.0 and the following versions show the refresh principle, refresh the adaptation

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.