使用SwipeBackLayout实现滑动退出页面的效果

慕学海
2023-12-01

先提供SwipeBackLayout的github:SwipeBackLayout


很简单,四步:

1. gradle  

compile 'me.imid.swipebacklayout.lib:library:1.0.0'

2.extends SwipeBackActivity


3.给activity的主题里面加一句:


<item name="android:windowIsTranslucent">true</item>


4.拿到 SwipeBackLayout,然后设置方向


mSwipeBackLayout = getSwipeBackLayout();

mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT);


方向有四个选项:

SwipeBackLayout.EDGE_LEFT
SwipeBackLayout.EDGE_RIGHT
SwipeBackLayout.EDGE_BOTTOM
SwipeBackLayout.EDGE_ALL




 类似资料: