- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个窗口弹出类,它在 aos 2.x(如 2.2.2、2.3.5 等)中运行良好,但在 aos 4.x 中崩溃。导致崩溃的代码如下:
public void dismissPopup(){
if (!isVisible)
return;
isVisible = false;
final Animation animation = AnimationUtils.loadAnimation(activity, R.anim.popup_hide);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(final Animation animation) {
// The animation has ended
popupWindow.dismiss();
}
public void onAnimationRepeat(final Animation animation) {}
public void onAnimationStart(final Animation animation) {}
});
popupView.startAnimation(animation);
}
所以为了让它在 aos 4.x 中工作,我必须注释所有的动画线,就像它有 2b 一样:
public void dismissPopup(){
if (!isVisible)
return;
isVisible = false;
popupWindow.dismiss();
}
这在 aos 4.1.x 中工作正常,但不提供动画。这里可能是什么问题? android 不应该提供任何向后兼容性吗?
崩溃日志
04-25 21:05:50.387: E/AndroidRuntime(8997): FATAL EXCEPTION: main
04-25 21:05:50.387: E/AndroidRuntime(8997): java.lang.NullPointerException
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl.drawAccessibilityFocusedDrawableIfNeeded(ViewRootImpl.java:2301)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl.onHardwarePostDraw(ViewRootImpl.java:1931)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1182)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2147)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2019)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1830)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:736)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.Choreographer.doCallbacks(Choreographer.java:566)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.Choreographer.doFrame(Choreographer.java:536)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:722)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.os.Handler.handleCallback(Handler.java:615)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.os.Handler.dispatchMessage(Handler.java:92)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.os.Looper.loop(Looper.java:137)
04-25 21:05:50.387: E/AndroidRuntime(8997): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-25 21:05:50.387: E/AndroidRuntime(8997): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 21:05:50.387: E/AndroidRuntime(8997): at java.lang.reflect.Method.invoke(Method.java:511)
04-25 21:05:50.387: E/AndroidRuntime(8997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-25 21:05:50.387: E/AndroidRuntime(8997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-25 21:05:50.387: E/AndroidRuntime(8997): at dalvik.system.NativeStart.main(Native Method)
UPD:动画在 aos 4.0.3 中有效,但在 4.1.1 中崩溃
最佳答案
我发现它很愚蠢但解决方法是:
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(final Animation animation) {
// The animation has ended
new Handler().post(new Runnable() {
@Override
public void run() {
popupWindow.dismiss();
}
});
}
public void onAnimationRepeat(final Animation animation) {}
public void onAnimationStart(final Animation animation) {}
});
我什至无法想象为什么这有帮助,为什么在 4.1.1 中没有它就不能工作...
关于android - AOS 4.x 动画崩溃问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16221175/
我正在尝试将 iOS 设备名称连同 deviceToken 一起发送到我在 didRegisterForRemoteNotificationsWithDeviceToken 中的服务器。我的设备中有一
那些在人工智能(或同等)领域工作过或工作过的人应该对 AO* 算法非常了解。 很明显它是一个通用算法。 你们中有人遇到过 AO* 算法的任何实际应用吗?你们中的一些人可能已经使用过它。 因此,如果您能
我注意到在实现搜索算法时会使用一些数据结构。比如我们用queue来实现BFS,用stack来实现DFS,用min-heap来实现A*算法。在这些情况下,我们不需要显式构造搜索树。 但是我找不到一个简单
JavaScript的执行过程 前言 编写一段JavaScript代码,它是如何执行的呢?简单来说,JS引擎在执行JavaScript代码的过程中需要先解析再执行。那么在解析阶段JS引擎又会进行哪些操
首次加载此页面时,AOS 运行良好。每个“白色方块”动画同时触发并且所有 6 个方块都可见。但是,我注意到,当我将浏览器调整为较小的大小,然后将其重新调整为较大的大小时,AOS 与我设置的媒体查询相结
通常在 HTML 文件中我像这样使用 AOS 我尝试以不同的方式在 CSS 文件中使用 AOS 和伪元素,但我没有这样做。你知道我该怎么做吗?感谢您的帮助 &::before {
我正在使用 AOS 库(css 和 js)它帮助我创建每次用户向下滚动页面时触发的动画。我有一个问题,我的页面的顶部元素只运行一次,因为 AOS 只在向下滚动时触发它。我希望我所有的动画运行 evry
我是 GatsbyJS 和 ReactJS 的新手,在构建项目时遇到问题。问题是每当我在其中构建带有 AOS 的项目时,它都会显示错误窗口未定义。当我在开发模式下运行时完全没问题。 这是我的代码: 我
在使用 OpenApi 规范的 swagger 文档中,您可以将 schema 包装在参数中以包含 application/json 的内容: parameters: - in: query
我在Android OS v4.x(尤其是4.0.3)上遇到一个问题,即在滚动时更改ListView的数据-发生崩溃是因为我试图更改的不是主UI线程的数据,这是不正确的: E/AndroidR
我在 PostgreSQL 中有这个选择: SELECT "field_1", "field_2","field_3", MIN(COALESCE(NULLIF("field_4",'') ,'TBD
我正在使用 AOS 库制作动画。当我使用动画向左和向右滑动时,页面的宽度变得比主体宽度更宽,使整个页面看起来很奇怪。我无法在网上找到任何解决方案,我想出的唯一解决方案是,如果我给应用动画的元素以 px
这又是一个极其简单的问题。只是我,还是 AOS.js 只适用于 div? 因为在下面的链接中,我在 h1 上尝试它,但它不起作用。我在 div 上试了一下,它起作用了。这是一个更大问题的一部分,该元素
假设我有一个使用结构数组 (AoS) 内存布局的大代码。我想用 C++ 构建一个零成本的抽象,它允许我以尽可能少的重构工作在 AoS 和 SoA 之间切换。 例如,使用具有访问成员函数的类 stru
我有一个窗口弹出类,它在 aos 2.x(如 2.2.2、2.3.5 等)中运行良好,但在 aos 4.x 中崩溃。导致崩溃的代码如下: public void dismissPopup(){
我正在尝试添加属性以通过 javascript 启动 AOS 动画,但它无法正常工作。现在,通过js添加属性,当动画启动时,不是显示元素,而是隐藏它。我想可能是因为元素先渲染,js在添加AOS属性后才
我正在尝试将 Michalsnik 的 Animate On Scroll 插件实现到我的 WordPress 网站中。但是,当我按照指示使用“data-aos”制作以下 div 时,该元素变成空白而
我正在使用fullpagejs和 AOS使一些 div 在滚动时从页面底部弹出(或者至少这是我想要实现的)。 不幸的是,它不起作用。 是的,我已阅读 FAQ全页的部分,是的,scrollbar 设置为
我使用FullPage用于在部分之间进行动画滚动。 我想让项目显示为 aos.js但是当 fullPage.js 工作时 aos 不起作用。 最佳答案 详情请参阅 the fullPage.js FA
我将 AOS(滚动动画)库与 vue 一起使用。 AOS提供自定义JS事件:document.addEventListener('aos:in', ({ detail }) => { console.
我是一名优秀的程序员,十分优秀!