Slidemenu is used to meet the pitfalls, slidemenu met

Source: Internet
Author: User

Slidemenu is used to meet the pitfalls, slidemenu met

1. When slidemenu is integrated, the builde tools of 19.0.1 will not be found in the package, and the gradle in the package will be changed to your current gradle version.

2. Use. There is a toggle () method, which can be used. Otherwise, it cannot be listened.

Private SlidingMenu mSlidingMenu; private Button btn; @ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout.Activity_slidemenu2); Btn = (Button) findViewById (R. id.Btn); Btn. setOnClickListener (Slidemenu2Activity. this); mSlidingMenu = new SlidingMenu (this); mSlidingMenu. setMode (SlidingMenu.RIGHT); // MSlidingMenu. setBehindOffsetRes (); // you can specify the offset mSlidingMenu. setAboveOffset (R. dimen.Sliding_menu_offset); MSlidingMenu. setBehindOffset (getPing ()/4); mSlidingMenu. setMenu (R. layout.Slidingmenulayout); // MSlidingMenu. setTouchModeAbove (SlidingMenu. TOUCHMODE_FULLSCREEN); mSlidingMenu. attachToActivity (this, SlidingMenu.SLIDING_CONTENT); // Which Activity object to bind}
@Overridepublic void onClick(View v) {    Log.i("tag","sdflakjflsa");     mSlidingMenu.toggle();}public int getPing(){    DisplayMetrics displayMetrics=new DisplayMetrics();    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);    int width=displayMetrics.widthPixels;    return width;}

3. We can not only directly create slidemenu, but also inherit the slidemenufragmentactivity class,

Write and call toggle () in it ();

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.