滑动关闭实现

来源:互联网 发布:excel 重复数据统计 编辑:程序博客网 时间:2024/06/17 02:02

1.加载gradle依赖:compile 'com.github.liuguangqiang.swipeback:library:0.3.0@aar'

2.在布局上加入布局标签

<com.liuguangqiang.swipeback.SwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/swipeBackLayout"    android:layout_width="match_parent"    android:layout_height="match_parent">
3.代码中获取这个对象,设置滑动方向:swipeBackLayout.setDragEdge(SwipeBackLayout.DragEdge.LEFT);

注意:要在主题里进行一些设置,必须包含:否则滑动效果背景有问题

<!-- 窗口的背景颜色 -->        <item name="android:windowBackground">@android:color/transparent</item>        <item name="android:windowIsTranslucent">true</item>


0 0
原创粉丝点击