SwipeBackLayout侧滑关闭页面
implementation 'com.cxz:swipeback:1.0.1'
public class MainActivity extends SwipeBackActivity{
private SwipeBackLayout mSwipeBackLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mSwipeBackLayout = getSwipeBackLayout();//获取SwipeBackLayout
}
}
mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT);
mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
@Override
public void onScrollStateChange(int state, float scrollPercent) {
}
@Override
public void onEdgeTouch(int edgeFlag) {
vibrate(VIBRATE_DURATION);
}
@Override
public void onScrollOverThreshold() {
vibrate(VIBRATE_DURATION);
}
});