Android:如何显示只有资源整数ID的图标?

时间:2015-11-13 10:06:22

标签: android android-notifications

在Notification类中,小图标作为整数资源ID给出。如何在ImageView中以图像形式显示?

3 个答案:

答案 0 :(得分:0)

首先,您需要创建ImageView,然后通过以下代码为ImageView设置图片资源

yourImageview.setImageResource(id); // id is your Integer resource

希望这个帮助

答案 1 :(得分:0)

呀。之前我尝试过,但在这种情况下完全工作我们还需要一件事。图像是不同包的资源。

这里的解决方案是:

Progressable

答案 2 :(得分:-1)

只需将资源ID设置为imageView参考对象,如

ImageView imageView = (ImageView) findViewById(R.id.yourImageView);
// and then set the resource id to your imageView
imageView.setImageResource(resourceID);
相关问题