This article explains
The main interface to customize the bottom menu to use the explanation
The main interface is that day task interface fragmentactivity
Customizing menu functionality requires importing V1uilibrary.
Source Address: Https://github.com/vomzoo/VOMAndroidUILib
In the main interface just call the custom menu, specific implementation temporarily see V1uilibrary source code
Effect
Flow chart
Main UI Features
1> rewrite Oncreateoptionsmenu and add an item
/** * To customize menu, you must create an item */@Overridepublicboolean Oncreateoptionsmenu (Menu menu) { menu.add ("menu"); return Super . Oncreateoptionsmenu (menu);}
2> override onmenuopened to intercept the default menu and set menu
/*** Block Menu * Returns FALSE, indicating that the custom menu is displayed*/@Override Public BooleanOnmenuopened (intFeatureid, Menu menu) { if(Custommenupopupwindow! =NULL) { if(Custommenupopupwindow.isshowing ()) {Custommenupopupwindow.dismiss (); } Else { //Display window//To set the location that layout displays in PopupwindowCustommenupopupwindow.showatlocation ( This. Findviewbyid (r.id.todaytasklinearlayout), Gravity.bottom| Gravity.center_horizontal, 0, 0); } } return false;}
3> Create an implementation Onitemclicklistener class to set the Menu Items
/*** Menu click event * Click to jump*/ classBodyclickeventImplementsOnitemclicklistener {@Override Public voidOnitemclick (adapterview<?> adapterview, view view,intposition,LongArg3) { if(Position! = 2) {context.startactivity (NewIntent (context, resultclassarray[position])); if(Custommenupopupwindow.isshowing ()) {Custommenupopupwindow.dismiss (); } if(Position = = 1) {activity.finish (); } } Else{Systemutil.exitapp (activity); } }}
4> Initial Customization Menu
/** * Initialize to create a custom menu * Third parameter, menu background, 0 for white */ privatevoid Initnewpopupwindow () { new Custommenupopupwindow ( thisnew bodyclickevent (), systemutil.screenheight); Custommenupopupwindow.setbodyadapter (Bodyadapter); }
More please download the Source code interpretation
Application Download: please click
Source Download: please click
Android Project Combat-recite the words dev05-the main interface custom menu