介绍:一个支持滑动显示另一个布局的布局。
效果:

使用说明:Features
-
灵活,很容易和RecyclerView,ListView或者任何需要视图绑定的view一起使用。
-
四个drag边缘(左右上下)。
-
两种drag模式:
-
普通(第二个视图在主view的下面)。
-
同级(第二个视图紧贴主view的边缘).
-
-
最小api4
Drag 模式
Drag mode normal:

使用说明:
1依赖dependencies {
compile 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.0.0'
}
2布局文件<com.chauthai.swipereveallayout.SwipeRevealLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mode="same_level"
app:dragEdge="left">
<!-- Your secondary layout here -->
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<!-- Your main layout here -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.chauthai.swipereveallayout.SwipeRevealLayout>
app:mode 可以为 normal 或者 same_level
app:dragEdge 可以为 left, right, top 或者 bottom
和 RecyclerView, ListView, GridView...一起使用在Adapter class中:
3
public class Adapter extends RecyclerView.Adapter {
// This object helps you save/restore the open/close state of each view
private final ViewBinderHelper viewBinderHelper = new ViewBinderHelper();
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
// get your data object first.
YourDataObject dataObject = mDataSet.get(position);
// Save/restore the open/close state.
// You need to provide a String id which uniquely defines the data object.
viewBinderHelper.bind(holder.swipeRevealLayout, dataObject.getId());
// do your regular binding stuff here
}
}
https://mp.weixin.qq.com/s/HR3fqnaqeh1oLBuu5ZFNOQ
















