Slidingmenu in Android

Source: Internet
Author: User

Introduction

Slidingmenu as a sliding sidebar is mainly used instead of the Android traditional menu menus.

Import Method

Slidingmenu previously relied on another open source Library Actionbarsherlock, but is now replaced by AppCompat. Only need to import Slidingmenu Library, APPCOMPAT-SUPPORT-V7 will import the project by default

Specific: Andriod studio->file->new->import Module, select Slidingmenu-master\library, After the import, you need to modify the Buildtoolsversion property in the project's Build.gradle, instead of 19.1.0.

How to use
Slidingmenu = new Slidingmenu (this); Slidingmenu.setmode (Slidingmenu.left); Slidingmenu.setbehindoffsetres ( R.dimen.sliding_menu_offset); Slidingmenu.settouchmodeabove (Slidingmenu.touchmode_fullscreen); Slidingmenu.attachtoactivity (this, slidingmenu.sliding_content); Slidingmenu.setmenu (R.layout.slidingmenu);

The meaning of each API can be referred to ctrl+q interpretation, are better understood.

R.layout.slidingmenu refers to the Slidingmenu layout file:

<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android"              android:layout_width= "Match_ Parent "              android:layout_height=" match_parent "        android:background=" #FF999999 ">    < Com.jeremyfeinstein.slidingmenu.lib.SlidingMenu            android:id= "@+id/slidingmenulayout"            android:layout_ height= "Match_parent"            android:layout_width= "match_parent" >        <button                android:text= "click Me"                android:layout_width= "match_parent"                android:layout_height= "wrap_content" >        </Button>    </com.jeremyfeinstein.slidingmenu.lib.SlidingMenu></LinearLayout>

  

R.dimen.sliding_menu_offset refers to the distance that Slidingmenu can be delineated:

<resources>    <!--Default screen margins, per the Android Design Guidelines-    <dimen name= " Sliding_menu_offset ">200dp</dimen></resources>

  

Slidingmenu in Android

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.