<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
public class ThreeActivity extends SwipeBackActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_three);
setSwipeFinishEnable(true);
}
}
<?xml version="1.0" encoding="utf-8"?>
<com.mocaris.swipebacklib.weight.SwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/sb"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
tools:context="com.mocaris.mocarslib.SecondActivity">
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.mocaris.swipebacklib.weight.SwipeBackLayout>
在代码设置是否可右滑退出,设置右滑监听
SwipeBackLayout sb = (SwipeBackLayout) findViewById(R.id.sb);
sb.setSwipeFinishEnable(true);
sb.setOnSwipeBackListener(listener);