- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要将按钮从一个位置移动到另一个位置。 View 位置移动工作正常,但只有旧区域是可点击的。
这是我的代码:
Button animatorButton = (Button)findViewById(R.id.animatorbutton);
ObjectAnimator objectAnimatorButton = ObjectAnimator.ofFloat(animatorButton, "translationX", 0f, 400f);
objectAnimatorButton.setDuration(1000);
objectAnimatorButton.start();
如何移动按钮以禁用旧的可点击区域?
最佳答案
你用的是什么安卓版本?在 3.0 之前,您需要在动画完成后手动移动 View 才能移动可点击区域。请参阅此回复作为引用”How to do interactive animation (translation) with Android。
在 3.0 和更新版本中,PropertyAnimator 也会移动可点击区域。您是否在 pre 3.0 设备上使用 nineoldandroid 动画包?如果是这样,您将只能看到 View 动画的效果,而看不到属性(又名可点击区域)移动的完整效果。
关于Android - 使用 ObjectAnimator 的移动按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15132980/
我有一组 View 能够在屏幕上向下移动并随后反向移动,但现在当我尝试移动 CardView 时,它会向下移动但不会向上移动。 当用户单击按钮时,它会提示 View 集合下拉/消失,当用户再次单击该按
这是我的对象动画师 xml //Animating the NormalLayout final ObjectAnimator anim4 = (ObjectAnimator) //Ob
我有一个 View (sendSidePanel),我在呈现 View 时将其隐藏: public void setListnerToRootView(){ final View activit
我正在使用 kotlin 解构声明。我之前将它与 SpringAnimation 一起使用,并且效果很好。现在我想将它与 ObjectAnimator 一起使用,但出现此错误: Destructuri
我正在尝试为进度条设置动画,以便线性填充需要 1 分钟。 这是我的代码: animator = ObjectAnimator.ofInt(progress_bar, "progress", 0, 10
我尝试在谷歌和各种堆栈问题中四处寻找,但似乎找不到与我正在做的事情相似的东西。 基本上,我只想在动画的某个偏移量处开始给定的 ObjectAnimator 动画(例如,通过动画 30%,或通过动画 7
起初,我以为我的动画根本不起作用,因为新的 Fragment ViewGroup 只会在一帧中出现在屏幕上。然后我放慢了动画速度,所以它需要 3 秒(3000 毫秒)并发现它只是以如此大的 block
我有一个包含 HorizontalScrollView 的 Activity 。 HorizontalScrollView 中有三个 fragment 。单击按钮时, ScrollView 将
我今天设计了两个可绘制的经典arrow 和hamburger 图标来重新创建和理解android 中的objectAnimator。当没有播放动画但更改了可绘制对象时会出现此问题。 我已经创建了 ic
我使用 ObjectAnimator API (android.animation.ObjectAnimator) 在按钮被点击后设置动画(v 是按钮): ObjectAnimator animato
我想要一个相对布局来放大并且 View 的底部应该是固定的。 我有一个相对布局 - private RelativeLayout rlOutdoorSection; 初始化它- rlOutdoorSe
我正在尝试查找 ObjectAnimator 可以设置动画的属性列表以及它如何设置动画。 例如,我想知道 translationY 属性是如何设置动画的。该值是要坐标还是距离? 最佳答案 Object
我正在尝试使用 Animator 集顺序播放一组动画。除了 alpha 动画 (set1) 外,一切正常。它从 0.25f 变为 1,但在整个动画中并没有消失,并且在 set1 动画结束时,它从 0.
我需要将按钮从一个位置移动到另一个位置。 View 位置移动工作正常,但只有旧区域是可点击的。 这是我的代码: Button animatorButton = (Button)findViewByI
我尝试制作ImageView 的扩展布局动画和平移 动画,但我同时启动它们时它们看起来有点滞后。我在真实设备 Moto X(2013) 上对其进行了测试。不确定更强大的设备,因为默认情况下我所有的模拟
我想使用 ObjectAnimator 在 Y 轴上移动一个 textView。这段代码有效,但由于屏幕尺寸的原因,它并不适合所有设备。 ObjectAnimator mover = Objec
我使用 Animator XML 为 ImageView 设置动画。 ImageView 应该增长(从 0f 到 1f,Y 比 X 快)并从 90 旋转 90° 到 0。我将此 XML 文件用于动画:
我正在使用 ObjectAnimator 滚动 HorizontalScrollView(左 -> 右 -> 左)。因此,结果应该是从一侧无限滚动到另一侧。 问题 是在我开始向右 -> 左设置动画
我正在尝试使用 ObjectAnimator 来制作向上滑动的翻译动画,因为我们知道,如果我们像这样使用普通的翻译动画,onclicklistener 将无法工作, 上面的 xml 代码工作正常,但
如果属性 x 被指定为字符串,ObjectAnimator 如何能够调用适当的方法 setX?我的意思是,使用什么技术来识别我想要为 View 的属性 rotation 设置动画并调用该 View 的
我是一名优秀的程序员,十分优秀!