【问题标题】:Android Button animation starting after click handler finished点击处理程序完成后开始的 Android Button 动画
【发布时间】:2018-02-10 16:45:00
【问题描述】:

我可以看到点击按钮时的动画是在 onClick 方法中的内容完成后开始的,并且我想知道这是 Android 错误还是正常行为?。我可以找到一些帖子 (this one e.g.) 关于人们在动画结束后搜索如何开始某事,所以我想我并不孤单,但是 我认为这根本不是逻辑

【问题讨论】:

    标签: android android-animation android-button


    【解决方案1】:
       YouButton. setOnTouchListener(
        new View.OnTouchListener() {
        public boolean onTouch(View myView, 
        MotionEvent event) {
            int action = event.getAction();
            if (action==MotionEvent.ACTION_UP)
            {
                //after animation 
            }
            if (action==MotionEvent.ACTION_DOWN)
            {
              //your animation 
            }
            return true;
        }
    }    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-18
      • 1970-01-01
      • 1970-01-01
      • 2016-03-22
      • 1970-01-01
      相关资源
      最近更新 更多