如何清除机器人的ImageView的? [英] How to clear an ImageView in Android?

查看:131
本文介绍了如何清除机器人的ImageView的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我resusing ImageViews我的显示器,但在某些时候,我没有价值,把它。

I am resusing ImageViews for my displays, but at some point I don't have values to put it.

因此​​,如何清除机器人的ImageView的?

So how to clear an ImageView in Android?

我已经试过:

mPhotoView.invalidate();
mPhotoView.setImageBitmap(null);

他们都没有被清除的观点,它仍然显示previous形象。

None of them have cleared the view, it still shows previous image.

推荐答案

这听起来像你想要的是一个默认的图像到您的ImageView设置时,它没有显示不同的图像。这是怎样的联系人应用程序做的:

It sounds like what you want is a default image to set your ImageView to when it's not displaying a different image. This is how the Contacts application does it:

if (photoId == 0) {
    viewToUse.setImageResource(R.drawable.ic_contact_list_picture);
} else {
    // ... here is where they set an actual image ...
}

这篇关于如何清除机器人的ImageView的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆