在图像视图android中设置android.R.drawable图像 [英] Set image from android.R.drawable in image view android

查看:121
本文介绍了在图像视图android中设置android.R.drawable图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何设置res / drawable中的图像/图标

i know how to set image/icon from our res/drawable

<ImageView android:id="@+id/ImageSearch" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/android_green_3d"/>

如果我们直接从代码中设置它:
imageView1.setImageResource(R.drawable。 android_green_3d);

If we set it directly from the code: imageView1.setImageResource(R.drawable.android_green_3d);

但我们也可以从android.R.drawable中获取这样的图标:
imageView1.setImageResource(android.R.drawable.ic_menu_more) ;

But we can also get the icon from android.R.drawable like this: imageView1.setImageResource(android.R.drawable.ic_menu_more);

如何在xml id中设置图像/图标,源是android.R.drawable?谁知道?
提前致谢。

How to set image/icon in xml id the source is android.R.drawable? Anyone know? Thanks in advance.

推荐答案

这很简单:更改 @drawable / @android:drawable / 。代码完成在这种情况下不起作用,因此您应该在GIT存储库中搜索或在线搜索图像及其名称

Thats easy: change @drawable/ to @android:drawable/. Code completion didn't work in this case, so you should search in the GIT repository or online for the images and their names

这篇关于在图像视图android中设置android.R.drawable图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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