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.

  • 相关阅读:
    Http与WWW服务精解
    Http与WWW服务精解
    6-13
    好用的工具说明
    JVM、JRE和JDK三者间的区别和联系
    css进阶之二:flex弹性布局
    MVVM
    如何理解TCP的三次握手协议?
    java里面的设计模式
    linux常用命令
  • 原文地址:https://www.cnblogs.com/qiengo/p/2519062.html
Copyright © 2011-2022 走看看