SwipeBackHelper
SwipeBackHelper copied to clipboard
楼主,发现问题:侧滑关闭后,toolbar位置会有灰色方块 闪烁一下
如题
那是你的你的Activity关闭动画加上statusbar的背景吧。改一下动画或将statusbar改为可绘
楼主下面这段是框架activity的主题,关闭activity并没有设置动画,是找错地方了么?谢谢 `
`
<style name="Base.Theme.normal" parent="Theme.AppCompat.Light.NoActionBar"> <!-- for library use when is in night theme--> <item name="themeColorSecondary">@color/theme_color_secondary</item> <item name="android:windowBackground">@color/window_background</item> <item name="android:textColorPrimary">@color/text_primary_color</item> </style>
重新贴下代码 ,上面有点乱,swipebackactivity的主题
<style name="Base.Theme.normal" parent="Theme.AppCompat.Light.NoActionBar"> <!-- for library use when is in night theme--> <item name="themeColorSecondary">@color/theme_color_secondary</item> <item name="android:windowBackground">@color/window_background</item> <item name="android:textColorPrimary">@color/text_primary_color</item> </style>
<style name="AppTheme.swipebacklayout" parent="Base.Theme.normal"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowAnimationStyle">@style/SlideRightAnimation</item> </style>
我也遇到过style定义的动画无效的情况。你的情况应该就是关闭动画的问题。你能自己分析下吗,顺便求结果。
楼主,这个问题原因没找到。 经过在日活5k的app测试,侧拉框架有时会报这个异常,每天后台会有10个,定位不到问题。 java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true
你这个问题应该和作者说的问题一样,这个是因为这个库插入的layout不包含StatusBar那一块区域,所以当你滑动结束后由于activity切换动画的原因导致StatusBar区域因为动画而位移,所以产生了闪烁的现象,为了解决这个问题,你需要自己去除系统的StatusBar自己重画一个,可以利用StatusBarUtil解决。
建议:使用StatusBarUtil后可能还是会出现statusBar显示异常,可以尝试在**onPostCreate()**方法追加:
SwipeBackHelper.onPostCreate(this); StatusBarUtil.setColor(this, getResources().getColor(R.color.blue),0);
SwipeBackHelper.getCurrentPage(this).setSwipeBackEnable(isSwipeBackEnable()).setSwipeRelateEnable(true).setSwipeEdge(DeviceUtils.dp2px(80)) .addListener(new SwipeListener() { @Override public void onScroll(float percent, int px) {
}
@Override
public void onEdgeTouch() {
}
@Override
public void onScrollToClose() {
onBackPressed();
//核心这句话,完成滑动后执行下自己的一段动画即可
overridePendingTransition(R.anim.in, R.anim.out);
}
});
great ,this method is solved my question