【问题标题】:Android - Moving button using ObjectAnimator is not workingAndroid - 使用 ObjectAnimator 的移动按钮不起作用
【发布时间】:2014-07-02 20:41:46
【问题描述】:

我需要将按钮从一个位置移动到另一个位置。查看位置移动工作正常,但只有旧区域是可点击的。

这是我的代码:

 Button animatorButton = (Button)findViewById(R.id.animatorbutton);
 ObjectAnimator objectAnimatorButton = ObjectAnimator.ofFloat(animatorButton, "translationX", 0f, 400f);
 objectAnimatorButton.setDuration(1000);
 objectAnimatorButton.start();

如何移动按钮以禁用旧的可点击区域?

【问题讨论】:

    标签: android animation objectanimator


    【解决方案1】:

    你用的是什么安卓版本?在 3.0 之前,您需要在动画完成后手动移动视图才能移动可点击区域。将此回复视为参考“How to do interactive animation (translation) with Android

    在 3.0 和更新版本中,PropertyAnimator 也会移动可点击区域。您是否在 3.0 之前的设备上使用 Nineoldandroid 动画包?如果是这样,您将只能看到视图动画的效果,而不是属性(也称为可点击区域)移动的全部效果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 2012-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多