zoukankan      html  css  js  c++  java
  • Android Animation Questions

    1.

     1 AnimationSet exitTransition = new AnimationSet(true);
     2         exitTransition.setDuration(1000);
     3         int xoffset=getResources().getDimensionPixelSize(R.dimen.list_width);
     4         int yoffset=getResources().getDimensionPixelSize(R.dimen.topbar_height);
     5         float xscale=(mShelvesView.getWidth()-xoffset)/(float)mShelvesView.getWidth();
     6         TranslateAnimation trans = new TranslateAnimation(
     7                 Animation.ABSOLUTE, 0, Animation.ABSOLUTE, xoffset,
     8                 Animation.ABSOLUTE, 0, Animation.ABSOLUTE, yoffset);
     9         ScaleAnimation scales= new ScaleAnimation(1f,xscale,1f,1f);
    10         exitTransition.addAnimation(scales);
    11         exitTransition.addAnimation(trans);
    12         exitTransition.setFillAfter(true);
    13         mShelvesView.startAnimation(exitTransition);

    I create an animation ues this code in Android 4.0,and it runs properly.However ,when I run it on Android 3.1 device,the animation process is gone.It directly jump to the last position.

    Answers:

    add this two lines :

    trans.setDuration(1000);
    scales.setDuration(1000);

    then it will be ok.

  • 相关阅读:
    Java异常简介
    Java中的接口
    Java中的抽象类
    Java的多态
    关于this
    面向对象的继承方式详解
    1像素边框问题
    HTML5之本地存储SessionStorage
    js数组去重的4个方法
    前端模块化
  • 原文地址:https://www.cnblogs.com/qiengo/p/2519062.html
Copyright © 2011-2022 走看看