2
我正在尝试使框架动画保持在图像视图的中心位置,在图像下载前动画正在其中播放。基本上它是一个装载微调器的动画。这是我在xml文件中的imageview。Android:框架动画绵延到查看大小
<TableRow
android:gravity="center" >
<ImageView
android:id="@+id/imageViewUrl1"
android:layout_width="0dp"
android:layout_height="94dp"
android:layout_gravity="center"
android:layout_weight="0.5"
android:adjustViewBounds="true"
android:gravity="center"
android:onClick="OnClickThumbnail"
android:paddingTop="10dp"
android:scaleType="fitCenter"
android:textColor="@android:color/white"
android:src="@drawable/frameblack" />
这里是我的框架xml文件
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item android:drawable="@drawable/framezero" android:duration="60" />
<item android:drawable="@drawable/frameone" android:duration="60" />
<item android:drawable="@drawable/frametwo" android:duration="60" />
<item android:drawable="@drawable/framethree" android:duration="60" />
<item android:drawable="@drawable/framefour" android:duration="60" />
<item android:drawable="@drawable/framefive" android:duration="60" />
<item android:drawable="@drawable/framesix" android:duration="60" />
<item android:drawable="@drawable/frameseven" android:duration="60" />
<item android:drawable="@drawable/frameeight" android:duration="60" />
<item android:drawable="@drawable/framenine" android:duration="60" />
<item android:drawable="@drawable/frameten" android:duration="60" />
</animation-list>
这里是代码即时通讯使用启动动画
final ImageView imageView = (ImageView) findViewById(R.id.imageViewUrl1);
AnimationDrawable yourAnimation;
imageView.setBackgroundResource(R.drawable.loadinganim);
yourAnimation = (AnimationDrawable) imageView.getBackground();
yourAnimation.start();
的问题是,动画绵延整个宽度和高度的imageview。 imageview设置为fitCenter。我该如何避免这种情况?