gpt4 book ai didi

Android - 沿 Y 轴旋转对象

转载 作者:行者123 更新时间:2023-11-29 21:13:16 25 4
gpt4 key购买 nike

我的应用程序中有一个 TextView,我希望它从左边缘沿 Y 轴旋转。

使用这段代码,

<rotate 
android:fromDegrees="90"
android:toDegrees="0"
android:pivotX="0%"
android:pivotY="0%"
android:duration="2000" />

我可以让它沿左边缘旋转,但它不会沿 Y 轴移动。

但是,当我使用 objectAnimator 时,它会使用其 rotationY 属性沿 Y 轴移动,但是我无法设置值 pivotXpivotY 这使得它沿着中心而不是从左边缘旋转。

如何同时实现这两件事?

请帮帮我!!

提前致谢。

最佳答案

检查这个card flip animation来自安卓。基本上你定义了 4 个动画并设置动画顺序

    getFragmentManager()
.beginTransaction()
.setCustomAnimations(
R.animator.card_flip_right_in, R.animator.card_flip_right_out,
R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.container, new CardBackFragment())
.addToBackStack(null)
.commit();

您可能想要更改角度和“valueFrom”、“valueTo”属性以满足您的需要。

关于Android - 沿 Y 轴旋转对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22140448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com