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);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents