您的位置:首页 > 移动开发 > Android开发

AndroidSwipeLayout:最强大的 Swipe Layout

2016-04-20 14:48 453 查看
http://hao.jobbole.com/androidswipelayout/

AndroidSwipeLayout是一个很强大的 Swipe Layout,和SwipeListView相比, 它不局限于ListView,点击图片观看效果





特性

轻松的整合ListView GridView ViewGroup
能回调 onOpen(), onUpdate
可以通知子元素
可以处理复杂的情况

下载

gradle

Java

1234dependencies { compile 'com.android.support:support-v4:20.+' compile "com.daimajia.swipelayout:library:1.1.7@aar"}
mavenJava

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

1234567891011121314151617181920212223<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>
Java

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

SwipeLayoutswipeLayout= (SwipeLayout)findViewById(R.id.sample1);

//set show mode.

swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);

//set drag edge.

swipeLayout.setDragEdge(SwipeLayout.DragEdge.Left);

swipeLayout.addSwipeListener(newSwipeLayout.SwipeListener(){

@Override

publicvoidonClose(SwipeLayoutlayout){

//when
the SurfaceView totally cover the BottomView.

}

@Override

publicvoidonUpdate(SwipeLayoutlayout,intleftOffset,inttopOffset){

//you
are swiping.

}

@Override

publicvoidonOpen(SwipeLayoutlayout){

//when
the BottomView totally show.

}

@Override

publicvoidonHandRelease(SwipeLayoutlayout,floatxvel,floatyvel){

//when
user's hand released.

}

});

github网址 https://github.com/daimajia/AndroidSwipeLayout/wiki/usage
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: