Android 碎片动画后的致命信号11
我目前正在尝试实现类似这样的片段事务动画(片段相关类从支持库导入): 动画的定义如下所示: .xml中的幻灯片Android 碎片动画后的致命信号11,android,android-fragments,android-animation,Android,Android Fragments,Android Animation,我目前正在尝试实现类似这样的片段事务动画(片段相关类从支持库导入): 动画的定义如下所示: .xml中的幻灯片 <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="-100%p" android:toXDelta="0" android:interpolator="@android:a
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="-100%p"
android:toXDelta="0"
android:interpolator="@android:anim/linear_interpolator"
android:duration="500"/>
</set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="-100%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="500"/>
</set>
每当我删除setCustomAnimations行时,这段代码在每次运行时都能正常工作。这里可能存在什么问题?我如何解决/解决它
编辑:设法缩小了问题的范围:
当被替换的片段事务包含一个webview,其VideoEnabledWebChromeClient如附件所示时,就会发生这种情况
该错误也只发生在淡出动画上(这就是为什么它似乎只发生在第二次)。当我将动画更改为
trans.setCustomAnimations时(R.anim.eqdpost\u slide\u in,0)代码>a它工作正常。找出了导致此问题的原因
这是参与事务的片段中的此方法,在滑出动画发生时触发:
@Override
public void onDestroyView() {
super.onDestroyView();
_webView.destroy();
_webView = null;
}
\u webView.destroy()
调用从内存中释放webView。但是,由于某种原因,\u webView=null
语句不仅将_webView指针设置为null,它还在将_webView指针设置为null之前在本机级别上调用webView上的destroy()
方法。
因为一旦\u webview=null,webview已经被销毁调用code>时,出现本机错误
按如下所示更改方法可修复此问题:
public void onDestroyView() {
super.onDestroyView();
_webView = null;
}
我有一个类似的问题,我通过将support-v4
库升级到23.1.0
(从23.0.1
)解决了这个问题:
compile'com.android.support:support-v4:23.1.0'
我无法告诉您这段代码有多少内容,但当您试图在边界之外绘制某些内容时,经常会发生此错误。
@Override
public void onDestroyView() {
super.onDestroyView();
_webView.destroy();
_webView = null;
}
public void onDestroyView() {
super.onDestroyView();
_webView = null;
}