Android Open Source--menudrawer

Source: Internet
Author: User

Open Source Address: Https://github.com/SimonVT/android-menudrawer

Introduction: Menudrawer is similar to the slidermenu of a framework, often used to do the Setup interface, with menu as the Settings menu, Contentview as a detailed page frame, such as



API Explanation:

**************************** left menudrawer***************************************
1. Setting up the home page
Menudrawer=menudrawer.attach (this,menudrawer.menu_drag_content);
Menudrawer.setcontentview (r.layout.activity_main);
2. Set Menu page/height
Menudrawer.setmenuview (mlistview);
menudrawer.setmenusize (Getwindowmanager (). Getdefaultdisplay (). getwidth ());
3. Main/menu page jumps to each other
Menudrawer.togglemenu ();
4. Close the menu page
Menudrawer.closemenu ();


5. Save and swipe on the right side of the label:
GetView (set tag): V.settag (r.id.mdactiveviewposition, position);
Onitemclicklistener (Set current active Item): Menudrawer.setactiveview (v,position);


6. When sliding (refresh indicator)
Mlistview.setonscrolllistener (New Onscrolllistener () {

@Override
Public void onscrollstatechanged (abslistview view, int scrollstate) {
}

@Override
Public void Onscroll (abslistview view, int firstvisibleitem,
int visibleitemcount, int totalitemcount) {
menudrawer.invalidate ();
}
});


7. Set the active area of the drag
Menudrawer.settouchmode (menudrawer.touch_mode_fullscreen);


8. The 4th parameter determines whether it can be dragged
Menudrawer=menudrawer.attach (this,menudrawer.menu_drag_content,position.right,true);


**************************** right/top bottom menudrawer***************************************
1. Set the home page (the 3rd parameter provides the 4 directions of the menu)
Menudrawer=menudrawer.attach (this,menudrawer.menu_drag_content, position.right);
2. Change the position of the indicator:
1) Modify the style in Androidmanifest.xml
android:theme= "@style/sampletheme.right"
2) Modify in Theme.xml:
<style name= "samplebase" parent= "@android: Style/theme.holo.light"/>


<style name= "sampletheme.right" parent= "Samplebase" >
<item name= "Menudrawerstyle" > @style/menudrawerstyle.right</item>
</style>
3) Modify in Style.xml:
<style name= "menudrawerstyle.right" parent= "Widget.menudrawer" >
<item name= "Mdactiveindicator" > @drawable/menu_arrow_right</item>
<item name= "mdmenusize" >200dp</item>
</style>


**************************** Custom menudrawer***************************************
XML:
The view layer must be a definition in Net.simonvt.menudrawer.TopDrawer four
the ID of the menu page must be android:id= "@id/mdmenu"
the ID of the home page must be android:id= "@id/mdcontent"
Code: Set Manual mode and set menu width/height
Menudrawer.settouchmode (menudrawer.touch_mode_fullscreen);
menudrawer.setmenusize (+);
the definition indicates the location: (indicates that the cursor is indicated by the theme specified in the manifest file) Menudrawer.setactiveview (v);


****************************menudrawer+viewpager***************************************
tip:1) home page implementation fragmentactivity;
2) onpageselected implementation in Onpagechangelistener:
Menudrawer.settouchmode (position==0? MenuDrawer.TOUCH_MODE_FULLSCREEN:MenuDrawer.TOUCH_MODE_NONE);



Android Open Source--menudrawer

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.