AndroidSwipeLayout:最强大的 Swipe Layout
2015-10-10 17:41
513 查看
AndroidSwipeLayout是一个很强大的 Swipe Layout,和SwipeListView相比, 它不局限于ListView,点击图片观看效果
特性
轻松的整合ListView GridView ViewGroup
能回调 onOpen(), onUpdate
可以通知子元素
可以处理复杂的情况
下载
gradle
Java
dependencies {
compile 'com.android.support:support-v4:20.+'
compile "com.daimajia.swipelayout:library:1.1.7@aar"
}
1 2 3 4 | dependencies { compile 'com.android.support:support-v4:20.+' compile "com.daimajia.swipelayout:library:1.1.7@aar" } |
Java
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r6</version>
</dependency>
<dependency>
<groupId>com.daimajia.swipelayout</groupId>
<artifactId>library</artifactId>
<version>1.1.7</version>
<type>apklib</type>
</dependency>
1 2 3 4 5 6 7 8 9 10 11 | <dependency> <groupId>com.google.android</groupId> <artifactId>support-v4</artifactId> <version>r6</version> </dependency> <dependency> <groupId>com.daimajia.swipelayout</groupId> <artifactId>library</artifactId> <version>1.1.7</version> <type>apklib</type> </dependency> |
Java
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="80dp">
<!-- Bottom View Start-->
<LinearLayout
android:background="#66ddff00"
android:id="@+id/bottom_wrapper"
android:layout_width="160dp"
android:weightSum="1"
android:layout_height="match_parent">
<!--What you want to show-->
</LinearLayout>
<!-- Bottom View End-->
<!-- Surface View Start -->
<LinearLayout
android:padding="10dp"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--What you want to show in SurfaceView-->
</LinearLayout>
<!-- Surface View End -->
</com.daimajia.swipe.SwipeLayout>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="80dp"> <!-- Bottom View Start--> <LinearLayout android:background="#66ddff00" android:id="@+id/bottom_wrapper" android:layout_width="160dp" android:weightSum="1" android:layout_height="match_parent"> <!--What you want to show--> </LinearLayout> <!-- Bottom View End--> <!-- Surface View Start --> <LinearLayout android:padding="10dp" android:background="#ffffff" android:layout_width="match_parent" android:layout_height="match_parent"> <!--What you want to show in SurfaceView--> </LinearLayout> <!-- Surface View End --> </com.daimajia.swipe.SwipeLayout> |
SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.sample1);
//set show mode.
swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
//set drag edge.
swipeLayout.setDragEdge(SwipeLayout.DragEdge.Left);
swipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() {
@Override
public void onClose(SwipeLayout layout) {
//when the SurfaceView totally cover the BottomView.
}
@Override
public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) {
//you are swiping.
}
@Override
public void onOpen(SwipeLayout layout) {
//when the BottomView totally show.
}
@Override
public void onHandRelease(SwipeLayout layout, float xvel, float yvel) {
//when user's hand released.
}
});
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.sample1); //set show mode. swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown); //set drag edge. swipeLayout.setDragEdge(SwipeLayout.DragEdge.Left); swipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() { @Override public void onClose(SwipeLayout layout) { //when the SurfaceView totally cover the BottomView. } @Override public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) { //you are swiping. } @Override public void onOpen(SwipeLayout layout) { //when the BottomView totally show. } @Override public void onHandRelease(SwipeLayout layout, float xvel, float yvel) { //when user's hand released. } }); |
转载:http://hao.jobbole.com/androidswipelayout/
相关文章推荐
- Android - 文件读写操作 总结
- 如何做 Android 应用流量测试
- 仿Android QQ左侧滑菜单右侧滑列表菜单——处理HorizontalScrollView和SwipeMenuListView滑动冲突
- Android 监听程序的安装和卸载
- Android ImageView加载摄像头拍摄的大图
- Android中使用lambda表达式
- Android Studio 安装以及使用中遇到的问题
- Android消息推送完美解决方案全析
- Android基础入门教程——8.1.2 Android中的13种Drawable
- Android编程中避免内存泄露的方法总结
- Android Notification几个特殊的视图
- Android中Handler引起的内存泄露
- android数据库的基本简单操作
- Android类-Service - ADIL
- android弹出对话框
- 开发过程中自己遇到的异常(一)
- Android应用截图方法
- android 如何在自定义对话框中获取edittext中的数据
- Android tabhost 切换activity时数据不刷新
- AndroidStudio无法更新代码