Set image from android.R.drawable in image view android

偶尔善良 提交于 2019-12-10 00:36:37

问题


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"/>

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

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

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


回答1:


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



来源:https://stackoverflow.com/questions/3683179/set-image-from-android-r-drawable-in-image-view-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!