带有ScrollView的Android旋转动画

问题描述 投票:6回答:2

我正在尝试制作自定义滚动视图的动画,我已使用LayoutParams(高度和宽度)调整了它的大小。

类似的东西:

ObjectAnimator rotation = ObjectAnimator.ofFloat(view, "rotation", rotationValue);
rotation.start();

动画运行得很好,但是所有ScrollView的内容都在旋转枢轴范围内绘制。图片已附上。

有人吗?谢谢。

之前:http://i.stack.imgur.com/TIxZL.png

之后:http://i.stack.imgur.com/EWtag.png

android animation scrollview
2个回答
0
投票

我怀疑您的问题是您需要在父级android:clipChildren上设置ViewGroup属性。

引用ViewGroup documentation for android:clipChildren

[定义是否限制孩子在其边界内绘制。例如,这对于将子级的大小缩放到100%以上的动画很有用。在这种情况下,应将此属性设置为false,以允许孩子画画超出其边界。此属性的默认值为true。

因此,如果要以编程方式构建接口,则将ViewGroup添加到XML布局中,或者调用ViewGroup的android:clipChildren方法。

© www.soinside.com 2019 - 2024. All rights reserved.