Using Slidingmenu for Android side-by-side menu effects

Source: Internet
Author: User

Previous article we learned how to configure the Android Studio Slidingmenu

Let's learn how to use Slidingmenu

The use of Slidingmenu is very simple

You only need to add the following in the OnCreate method:

1         slidingmenu = new Slidingmenu (this); 2         Slidingmenu.setmode (slidingmenu.left); 3         slidingmenu.setbehindoffsetres (r.dimen.sliding_menu_offset); 4         Slidingmenu.settouchmodeabove (slidingmenu.touchmode_fullscreen); 5         slidingmenu.attachtoactivity (this, slidingmenu.sliding_content); 6         Slidingmenu.setmenu (R.layout.slidingmenu);

and creating a layout file:

1 <?XML version= "1.0" encoding= "Utf-8"?>2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 Android:background= "@color/color_sliding_menu"6 android:orientation= "vertical">7 8 9     <ButtonTen         Android:layout_width= "Wrap_content" One Android:layout_height= "Wrap_content" A Android:text= "click me" - android:layout_gravity= "Center_horizontal" /> -  the     <Com.jeremyfeinstein.slidingmenu.lib.SlidingMenu -         Android:id= "@+id/slidingmenu" - Android:layout_width= "Wrap_content" - Android:layout_height= "Match_parent" + Android:background= "@color/coloraccent"> -  +     </Com.jeremyfeinstein.slidingmenu.lib.SlidingMenu> A  at </LinearLayout>

It's basically done.

On the following:

If you want to know more about Navigationview and drawerlayout, you can continue reading my blog post.

Using Slidingmenu for Android side-by-side menu effects

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.