Set Image Resource

suggest change
<ImageView
 android:id="@+id/imgExample"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 ...
 />

set a drawable as content of ImageView using XML attribute:

android:src="@drawable/android2"

set a drawable programmatically:

ImageView imgExample = (ImageView) findViewById(R.id.imgExample);
imgExample.setImageResource(R.drawable.android2);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents