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.

  • 相关阅读:
    基本数据类型转换
    java8新增的日期时间包
    算法之冒泡排序
    基本数据类型
    spring入门
    JiuDuOj——1020
    JiuDuOj——1051
    2015.11.26——Accelerated C++
    POJ2681——求字符串长度
    POJ1017——装箱问题
  • 原文地址:https://www.cnblogs.com/qiengo/p/2519062.html
Copyright © 2011-2022 走看看