android2.3使用AnimationUtils.loadAnimation()加载动画出现异常
2017-02-05 10:49
477 查看
问题描述:
用AnimationUtils.loadAnimation()方法加载动画,在android5.0上正常,在android2.3上异常闪退。动画xml文件:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="100"
android:interpolator="@android:interpolator/accelerate_quad"
android:fillAfter="true"
android:fillBefore="true"
android:fromXScale="100%"
android:fromYScale="100%"
android:pivotX="0"
android:pivotY="0"
android:toXScale="100%"
android:toYScale="0%" />
</set>
问题原因:
(1).在xml中配置插补器最低api要求是11,项目中配置的是8(2).弃用xml中配置的插补器后仍报错,异常如下,最后发现是android低版本不支持fromXScale、fromYScale等参数值为100%、0%的转换
解决方案:
(1).弃用xml中的插补器配置(2).fromXScale、fromYScale的值改为Float类型
最后修改后的动画xml文件如下,在android2.3上正常加载:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<scale
android:duration="100"
android:fillAfter="true"
android:fillBefore="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="0"
android:pivotY="0"
android:toXScale="1.0"
android:toYScale="0.0" />
</set>
相关文章推荐
- Android编程之Fragment使用动画造成Unknown animation name: objectAnimator异常
- Android下Animation动画的使用 及 Volley加载图片动画实现
- android 在使用ViewAnimationUtils.createCircularReveal()无法兼容低版本的情况下,另行实现圆形scale动画
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android常用动画Animation的使用
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android的Animation之LayoutAnimation使用方法(控件设置动画)
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android Animation Tween动画效果的使用
- Android常用动画Animation的使用
- Android动画(Animation)使用
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- android 视图动画的使用,Animation重写 实现旋转效果
- Android Animation学习(三) ApiDemos解析:XML动画文件的使用
- 【Android2D游戏开发十四】(未完待续)手把手教你在SurfaceView中照样使用Android 动画—Tween Animation!
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android动画:AnimationDrawable资源的简单使用
- 使用chrome调试ajax加载本地文件的时候出现Failed to load resource: Origin null is not allowed by Access-Control-Allow