Android Getting Started learning notes-dish single

Source: Internet
Author: User

Mainactivity.java Start Loading Menu

@Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (R.menu.main, menu); return true;}


Configure the menu under Res under menu Main.xml


<item        android:id= "@+id/lidl"        android:orderincategory= "android:title="          @string/action_ Settings "/>    <item        android:id=" @+id/end "android:orderincategory=" "android:title="          @ String/end "/>
Android:orderincatagory Menu Sorting

Android:id Index PRIMARY key

Android:title Menu Name


Menu Response Events

public boolean onoptionsitemselected (MenuItem item) {switch (Item.getitemid ()) {case R.id.lidl:toast.maketext (this, " T1 ", Toast.length_short). Show (); Break;case R.id.end:toast.maketext (This," T2 ", Toast.length_short). Show (); return super.onoptionsitemselected (item);}

Through the brothers Lianyun Classroom, know the menu settings of the process, and 2.3 before the menu can customize the icon, 2.3 after the cancellation of the function


At this stage, a lot of calls to the method feel a bit masked


Android Getting Started learning notes-dish single

Related Article

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.