如何使用其他资源图标更改图像视图中的资源图标

时间:2013-08-31 18:02:12

标签: android resources imageview

我一直在阅读一些关于在ImageView中更改图像的帖子 但是每个人都要求使用自定义图像设置ImageView,我想在其中设置系统图像。

我做到了:

ledicon.setImageDrawable(getResources().getDrawable(R.drawable.presence_busy));

但Eclipse告诉我,presence_busy无法识别 为什么呢?

我在XML文件中使用了presence_online,

android:src="@android:drawable/presence_online"

并且一切都很完美。

1 个答案:

答案 0 :(得分:2)

试试这个:

ledicon.setImageDrawable(getResources().getDrawable(android.R.drawable.presence_busy));

(访问系统资源时,你必须在android.R中查看它们,而不是你自己的。)