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.

  • 相关阅读:
    CLR
    Cocos2dx 3.12 在AndroidStudio上编译配置
    MFC 调试方法
    列表初始化
    类型转换
    Cocos2d-x 3.4在AndroidStudio上编译配置
    出发 Let's Go
    LumiSoft.Net邮件接收乱码问题解决
    百度地图经纬度转换JS版
    百度经纬度和google经纬度互转
  • 原文地址:https://www.cnblogs.com/qiengo/p/2519062.html
Copyright © 2011-2022 走看看