2012-11-14 77 views
1

我使用以下代码旋转图像重叠角

<rotate 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:fromDegrees="0" 
android:toDegrees="360" 
android:pivotX="50%" 
android:pivotY="50%" 
android:repeatCount="infinite" 
android:duration="36000" /> 

Animation rotate = AnimationUtils.loadAnimation(this, R.anim.rotate); 
findViewById(R.id.yourImageId).startAnimation(rotate); 
rotate.reset(); 
rotate.start(); 

意图将图像旋转ImageView的内部。

由于此图像视图具有背景颜色,因此它会旋转整个ImageView控件,并且它开始与放置在其旁边的文本视图重叠,例如,旋转45度后,一个角将重叠放置在左侧的视图它的

我想表明容器不旋转,而只是图像。

我不能删除背景,这将扰乱我在特定情况下的用户界面感觉。

将此放入布局并从此imageview中移除背景并旋转是否是个好主意?还是有一个更聪明的方法呢。

回答

0

您可以重叠2个视图(一个只与背景和另一个与您的图像),并设置Animation只旋转与图像的视图。

问候。