Slidingmenu Imitation NetEase 360 mobile phone assistant frame directly to use

Source: Internet
Author: User

The weather is too hot to go to work with no mental head. Simply clean up the framework used in the project to extract, convenient next time to use it.

We should all know slidingmenu. GitHub is an open-source framework can be left and right sliding, the current many apps are used, such as NetEase News, 360 mobile phone assistant, embarrassing encyclopedia, Ireader. It should be a very good frame of fire.

No exception our company's projects are also used. There's a lot of crap. Let's go straight to the subject.


First, we introduce the structure of the framework

First a few pictures, do not do gif.


And look at the package structure.

The main implementation of the slide-off function code in the Slidingmenu package. Sliding package is mainly put in the left and right two fragment is the top of the first and last interface.

The UI is placed in the main interface can be Viewpager added in the three fragment and the left menu in the live Hall leaderboard concerns, three fragment.


Then how to use it. The first thing to Mainacitivity is to introduce slidingmenu in the layout to refer to the custom control. The full path name.

Then add a level one or two interface to the Slidingmenu in Mainacitivity. and SetContent.

The code is as follows:

Mslidingmenu = (slidingmenu) Findviewbyid (R.id.slidingmenu); Mslidingmenu.setmenu (R.layout.sliding_left_frame) ; Set the left side if (Getfragmentbytag (leftfragment.class) = = null) {Getsupportfragmentmanager (). BeginTransaction (). Add ( R.id.left_frame, New Leftfragment (), LeftFragment.class.getName ()). commit ();} Mslidingmenu.setcontent (R.layout.sliding_center_frame); Set Intermediate mslidingmenu.setsecondarymenu (R.layout.sliding_right_frame); Set the right if (Getfragmentbytag (rightfragment.class) = = null) {Getsupportfragmentmanager (). BeginTransaction (). Add ( R.id.right_frame, New Rightfragment (), RightFragment.class.getName ()). commit ();} if (mcurfragment! = null) {postswitchfragment ();} Mslidingmenu.settouchmodeabove (Slidingmenu.touchmode_margin); Sets the touch mode. This is the edge slide, can also be changed to fullscreen. 


The remaining code is relatively simple. There is a need to look under the download to see below.

Attached Demo: click here.

Technology without him, only hand-cooked. This sentence is right, no need to envy others, refueling!

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.