Application of the Actionbar component for the optimization of the Registration Interface (i) Actionbar component layout implementation

Source: Internet
Author: User

Development steps:?

    • Create a actionbar_menu_register.xml menu resource file in the menu folder under Res?
    • To add a label to a resource file set one or more Actionbar feature options
1 //actionbar_menu_register.xml2 3 <?XML version= "1.0" encoding= "Utf-8"?>4 <MenuXmlns:app= "Http://schemas.android.com/apk/res-auto"5 xmlns:android= "Http://schemas.android.com/apk/res/android">6     <Item7     Android:id= "@+id/ab_return"8 android:orderincategory= "1"9 app:showasaction= "Ifroom|withtext"Ten Android:title= "Back"/> One </Menu>
    • In the Java org.socrates.mydiay.activity under Registeractivity.java, override the parent class method to complete the Actionbar setting
1 //Register_activity.java2 3  Public classRegister_activityextendsappcompatactivity {4    ......5      Public BooleanOncreateoptionsmenu (Menu menu) {6Menuinflater Inflater=getmenuinflater ();//Step 1: Dynamically introduce the layout file for the menu7Inflater.inflate (R.menu.actionbar_menu_register,menu);//Step 2: Bind the layout file using the Inflater method in Inflater8         return true;9     }Ten    ...... One}

Run:

Summary: Ctrl+o call up method list, direct input Oncreateo find Oncreateoptionsmenu method

Application of the Actionbar component for the optimization of the Registration Interface (i) Actionbar component layout implementation

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.