zoukankan      html  css  js  c++  java
  • android imageview按钮按下动画效果

      private ImageView today_eat;

      today_eat = (ImageView) view.findViewById(R.id.today_eat);
      today_eat.setOnClickListener(b);
      today_eat.setOnTouchListener(b);

    onTouch里面写动画事件

    public boolean onTouch(View v, MotionEvent event) {
    if (v.getId() == R.id.today_eat) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(today_eat,
    "scaleX", 0.93f, 1f);
    oa.setDuration(500);
    ObjectAnimator oa2 = ObjectAnimator.ofFloat(today_eat,
    "scaleY", 0.93f, 1f);
    oa2.setDuration(700);
    oa.start();
    oa2.start();
    }
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(today_eat,
    "scaleX", 1f, 0.93f);
    oa.setDuration(500);
    ObjectAnimator oa2 = ObjectAnimator.ofFloat(today_eat,
    "scaleY", 1f, 0.93f);
    oa2.setDuration(700);
    oa.start();
    oa2.start();
    }
    } else if (v.getId() == R.id.tomorrow_eat) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(tomorrow_eat,
    "scaleX", 0.93f, 1f);
    oa.setDuration(500);
    ObjectAnimator oa2 = ObjectAnimator.ofFloat(tomorrow_eat,
    "scaleY", 0.93f, 1f);
    oa2.setDuration(700);
    oa.start();
    oa2.start();
    }
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(tomorrow_eat,
    "scaleX", 1f, 0.93f);
    oa.setDuration(500);
    ObjectAnimator oa2 = ObjectAnimator.ofFloat(tomorrow_eat,
    "scaleY", 1f, 0.93f);
    oa2.setDuration(700);
    oa.start();
    oa2.start();
    }
    }
    return false;
    }
    }

      

      

     阿里巴巴图库

  • 相关阅读:
    图片水平垂直居中 多行文字垂直居中
    ie8支持rgba方法
    html5学习(1)
    青岛鲁银商品交易中心
    PHP 生成16 uuid
    探索区块链-挖框体验
    微信小游戏-微信提供了啥
    error: libXpm.(a|so)
    从0到9取4位不同数字的排列组合算法
    visual studio 2015 rc &cordova -hello world
  • 原文地址:https://www.cnblogs.com/zhaoleigege/p/4949148.html
Copyright © 2011-2022 走看看