ListView Slide Menu

Source: Internet
Author: User

Project to use the item in the ListView slide effect, find a few, finally sent a very good Swipemenulistview, recorded, for later use

An open source library on GitHub, very handy, git address: Https://github.com/baoyongzhang/SwipeMenuListView

The use of the method is also very simple

Operating Effect:



Instructions for use:

Add the Swipemenulistview to the XML:

<com.baoyz.swipemenulistview.swipemenulistview        android:id= "@+id/listview"        android:layout_width= " Match_parent "        android:layout_height=" Match_parent "/>


Create a swipemenucreator To add a menu item:

Swipemenucreator Creator = new Swipemenucreator () {@Override public void Create (Swipemenu menu) {//Create        "Open" Item Swipemenuitem OpenItem = new Swipemenuitem (Getapplicationcontext ());        Set Item background openitem.setbackground (New Colordrawable (Color.rgb (0xc9, 0xc9, 0xCE));        Set Item width openitem.setwidth (dp2px (90));        Set Item title Openitem.settitle ("Open");        Set Item title FontSize openitem.settitlesize (18);        Set Item title Font Color Openitem.settitlecolor (color.white);        Add to Menu Menu.addmenuitem (OpenItem);        Create "Delete" item Swipemenuitem DeleteItem = new Swipemenuitem (Getapplicationcontext ());         Set Item background deleteitem.setbackground (New Colordrawable (Color.rgb (0xf9, 0x3F, 0x25));        Set Item width deleteitem.setwidth (dp2px (90)); // Set a icon Deleteitem.seticon (r.drawable.ic_delete);    Add to Menu Menu.addmenuitem (DeleteItem); }};//set Creatorlistview.setmenucreator (creator);


Add listener to the Click event:


listView.setOnMenuItem  Clicklistener (New Onmenuitemclicklistener () {@Override public boolean onmenuitemclick (int position, Swipemenu menu,        int index) {switch (index) {case 0://Open break;        Case 1://delete break; }//False:close the menu;    True:not close the menu return false; }});


Reference: http://blog.csdn.net/jerehedu/article/details/45196203

ListView Slide Menu

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.