SwipeBackLayout是一个很好的类库,它可让Android实现相似iOS系统的右滑返回效果,可是不少用户在使用官方提供的Demo会发现,可能出现黑屏或者返回只是看到桌面背景而没有看到上一个Activity的UI。android
https://github.com/Issacw0ng/SwipeBackLayoutgit
解决方法以下:github
不要在首页打开滑动返回功能,并且在首页使用AppBaseThemeMain所示的主题,在须要滑动返回的Activity使用AppBaseTheme主题,这两个主题所设置的属性是指是否把window变成透明的,在首页的Activity就不能让window变得透明,须要滑动返回的Activity就须要设置该属性。
spa
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:windowIsTranslucent">true</item> </style>
<style name="AppBaseThemeMain" parent="@android:style/Theme.Holo.Light"> <item name="android:windowIsTranslucent">false</item> </style>