gpt4 book ai didi

android - 动画时比屏幕大的图像被裁剪

转载 作者:太空狗 更新时间:2023-10-29 12:45:15 26 4
gpt4 key购买 nike

我需要旋转一个比屏幕大的轮子图像(这是必须的)。

问题是 android:scaleType="center"是显示比屏幕大而不缩放的图像所必需的,并且这个相同的标签在旋转时裁剪图像(见下面的截图)

enter image description here

这是我的布局代码:

<ImageView 
android:id="@+id/wheel_img"
android:scaleType="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/wheel_test" />

我的 Activity :

ImageView wheel_img = (ImageView) findViewById(R.id.wheel_img);
wheel_img.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotation));

和 anim/rotation.xml

<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromDegrees="0"
android:toDegrees="30"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="true"
android:duration="2000" />

知道如何解决这个问题吗?这其实很紧急!

提前致谢!

最佳答案

这是我用的技巧

使用框架布局

   <FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<ImageView
android:id="@+id/wheel_image"
android:layout_width="image width"
android:layout_height="image height"
android:src="@drawable/wheel_test"
android:layout_gravity="center" />

很有魅力。

这是我在这里的第一个贡献。希望对你有用

关于android - 动画时比屏幕大的图像被裁剪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19050143/

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