zoukankan      html  css  js  c++  java
  • 增加动画的效果

    a) alpha(AlphaAnimation)

    渐变透明

    b) scale(ScaleAnimation)

    渐变尺寸伸缩

    c) translate(TranslateAnimation)

    画面转换、位置移动

    d) rotate(RotateAnimation)

    画面转移,旋转动画

     1 public void onClick(View v) {
     2                 if(grid_list) {
     3                     lv.setVisibility(View.VISIBLE);
     4                     gv.setVisibility(View.GONE);
     5                     lv.setAdapter(lvAdapter);
     6                     grid_list = false;
     7                     
     8                     Animation animation = new RotateAnimation(60,0);
     9                     animation.setInterpolator(MainActivity.this, android.R.anim.bounce_interpolator);
    10                     animation.setDuration(1000);
    11                     
    12                     lv.startAnimation(animation);
    13                 }
    14                 else {
    15                     lv.setVisibility(View.GONE);
    16                     gv.setVisibility(View.VISIBLE);
    17                     gv.setAdapter(gvAdapter);
    18                     grid_list = true;
    19                     Animation animation = new TranslateAnimation(130, 1, 130, 1);
    20                     animation.setDuration(1000);
    21                     animation.setInterpolator(MainActivity.this, android.R.anim.overshoot_interpolator);
    22                     //setInterpolator用来丰富动画效果,上面是超过又回来
    23                     gv.startAnimation(animation);
    24                 }

     若想让一个VIEW呈现多种动画效果,则要使用AnimationSet

    例如:

    AnimationSet set = new AnimationSet(false);

    set.addAnimation(animation);

    VIEW.startAnimation(set);

    可以理解为set是一种混合型的动画效果。

  • 相关阅读:
    BZOJ 1003 物流运输
    549565
    26566
    68
    554554
    5656
    49886
    5989
    6898
    656
  • 原文地址:https://www.cnblogs.com/hixin/p/4125087.html
Copyright © 2011-2022 走看看