Open leeyushi opened 4 years ago
R.anim.tran_enter_out代码: <?xml version="1.0" encoding="utf-8"?>
R.anim.tran_exit_out代码: <?xml version="1.0" encoding="utf-8"?>
第一个楼层的代码被吞掉了,我又补发了一下代码,顺带截图了,如果还被吞掉,就只能参考代码截图了
这个解决没
取消滑动返回时,将activity 设置回不透明即可解决
注意只有当Activity使用了非窗口透明的主题时才这么做,通过以下代码判断:
/**
* Determines whether the current Window is translucent or floating by default, according to
* the {@link android.R.attr#windowIsFloating} and {@link android.R.attr#windowIsTranslucent}
* attributes set in its theme.
*/
public static boolean isWindowTranslucentOrFloatingTheme(Window window) {
try {
@SuppressLint("PrivateApi")
Class<?> styleableClass =
window.getContext().getClassLoader()
.loadClass("com.android.internal.R$styleable");
return getWindowStyleBoolean(window, styleableClass, "Window_windowIsTranslucent", false)
|| getWindowStyleBoolean(window, styleableClass, "Window_windowIsFloating", false);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private static boolean getWindowStyleBoolean(
Window window,
Class<?> styleableClass,
String attrIndexName,
@SuppressWarnings("SameParameterValue") boolean defValue) throws Exception {
return window
.getWindowStyle()
.getBoolean(styleableClass.getField(attrIndexName).getInt(styleableClass), defValue);
}
版本是: me.imid.swipebacklayout.lib:library:1.3.0 退出的动画: @Override public void finish() { super.finish(); overridePendingTransition(R.anim.tran_enter_out, R.anim.tran_exit_out); } R.anim.tran_enter_out代码: <?xml version="1.0" encoding="utf-8"?>
R.anim.tran_exit_out代码: <?xml version="1.0" encoding="utf-8"?>
如果触发侧滑返回(从左边向右轻微拖动,然后再取消)只有R.anim.tran_exit_out的代码块会被执行到,R.anim.tran_enter_out不会执行,如果不触发侧滑返回,则两个都会执行到 测试环境: oppoR15真机,模拟器都会必现