SwipeMenuListView(左滑出菜单)

这篇博客介绍了如何在Android Studio(AS)中使用SwipeMenuListView控件创建左滑菜单,展示了效果,并提醒注意设置合适的item高度以避免菜单显示不全的问题。同时,文章提到了源码中存在一个bug,当左滑打开菜单后,滑动其他条目到顶部或底部时会出现异常行为。作者分析了问题出现在SwipeMenuListView的onTouchEvent方法。
摘要由CSDN通过智能技术生成

最近在https://github.com/中使用一个SwipeMenuListView(左滑出菜单)的控件,先上效果图:


感觉还挺好用,这里记录一下使用方法:

public class SwipeMenuListView extends ListView {
     //源码省略,请自行到github下载
}

可以看出直接使用这个控件即可,在xml中使用(记得把源码导入):

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.baoyz.swipemenulistview.SwipeMenuListView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>
接下来是在主函数中的使用方法,这里就是在每一条listview中去添加右边的菜单:

 mListView = (SwipeMenuListView) findViewById(R.id.listView);
        mListView.setAdapter(mAdapter);
        initSwipeMenu();
        initListener();
重要的方法就是 initSwipeMenu() initLisener() ,如下࿱
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值