我有列表视图,我希望每个列表项内的图像视图为圆形。另外我想让动画形象出现一种“淡入”动画。如何实现在动画中淡入淡出的圆形图像?
我已经试过这样:
private void setImageDrawable(ImageView imageView, Bitmap bitmap) {
if (mFadeInBitmap) { // mFadeInBitmap = true;
BitmapDrawable drawable = null, placeholder = null;
if (bitmap != null) {
drawable = new BitmapDrawable(mResources, bitmap);
placeholder = new BitmapDrawable(mResources, mPlaceHolderBitmap);
}
final TransitionDrawable td =
new TransitionDrawable(new Drawable[] {
placeholder,
drawable,
});
imageView.setImageDrawable(td);
td.startTransition(500);
} else {
imageView.setImageBitmap(bitmap);
}
}
但是这个代码不工作,因为我曾尝试使用CircleImageView和RoundedImageView为ImageView的。既不支持TransitionAnimation。
所以我不知道有什么简单的方法来实现在动画中淡入淡出的圆形图像?你会怎么做?
任何帮助,非常感谢。 在此先感谢!
尝试使用'android.support.v4.graphics.drawable.RoundedBitmapDrawable' – pskink