Android open-source -- SlideMenu

Source: Internet
Author: User

Android open-source -- SlideMenu

 

Introduction:This SlideMenu is no longer a new technology. It is mainly used to switch between the left, right, and right pages. The left and right pages are generally used as the setting pages.

 

The source code of SlideMenu references another open-source framework ActionBarSherlock. The main Activity of the application must inherit SlidingFragmentActivity.

This Activity is inherited from SherlockFragmentActivity. It mainly implements a FragmentActivity with a header ActionBar;

 

Main API details:

 

SlidingMenu sm = getSlidingMenu (); // initialize Slidemenusm. setSlidingEnabled (true); sm. setMode (SlidingMenu. LEFT_RIGHT); // set the mode for dragging the left and right of the master node. // set the drag range. TOUCHMODE_FULLSCREEN indicates that the full screen TOUCHMODE_MARGIN indicates that the sm is valid only when dragging around the main screen. setTouchModeAbove (sregistringmenu. TOUCHMODE_MARGIN); sm. setShadowWidthRes (R. dimen. shadow_width); sm. setShadowDrawable (R. drawable. shadow); sm. setBehindOffsetRes (R. dimen. slidingmenu_offset); // sets the visible width of the sliding rear main module sm. setBehindScrollScale (0.5f); // determines the sm of the blocked object based on the sliding volume. setFadeEnabled (true); // sets the gradient mode sm for conversion. setFadeDegree (0.8f); // set the Left and Right blocked page setBehindContentView (R. layout. left_menu_frame); getsuppactionactionbar (). setDisplayHomeAsUpEnabled (true); getsuppfrfragmentmanager (). beginTransaction (). replace (R. id. left_menu_frame, new NavigationFragment ()). commit (); sm. setSecondaryMenu (R. layout. right_menu_frame); sm. setSecondaryShadowDrawable (R. drawable. shadow); getSupportFragmentManager (). beginTransaction (). replace (R. id. right_menu_frame, new SettingFragment ()). commit (); getSlidingMenu (). showContent (); // display the home screen // getSlidingMenu (). showMenu (); // display the menu page // getSlidingMenu (). showSecondaryMenu (); // displays Level 2 menus

 

 

Tip: You need to leave an email address for the source code;

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.