This is the brother of AndroidViewHover.
One year ago, I started to make an app named EverMemo with my good friends. The designer gave me a design picture, the design like this:
I found it was pretty hard to achieve this effect, cause you had to be very familiar with the Android Touch System. It was beyond my ability that moment, and I also noticed that there was no such a concept library...
Time passed, finally...as you see right now.
Before I made this, I actually found some libraries (eg.SwipeListView) that helps developers to integrate swiping with your UI component. But they have too much limitation, only in ListView, or some other limitations.
When I start to make this library, I set some goals:
- Can be easily integrated in anywhere, ListView, GridView, ViewGroup etc.
- Can receive
onOpen
,onClose
,onUpdate
callbacks. - Can notifiy the hidden children how much they have shown.
- Can be nested each other.
dependencies {
compile "com.daimajia.swipelayout:library:1.0.0@aar"
}
<dependency>
<groupId>com.daimajia.swipelayout</groupId>
<artifactId>library</artifactId>
<version>1.0.0</version>
<type>apklib</type>
</dependency>
Create a SwipeLayout
:
SwipeLayout
must have 2 children (all should be an instance ofViewGroup
).
<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>
There are some preset examples: example1, example2, example3.
A student in mainland China.
Welcome to offer me an internship. If you have any new idea about this project, feel free to contact me. 😃