Reputation: 2469
i just looked at monodroid and am trying to figure out very simple. i want to click either of two buttons and depending on button pushed, display picture. using the samples/tutorials, i have done the buttons. Does anyone have a simple example of how to show picture? Guessing its ImageView, but haven't found any example
Upvotes: 0
Views: 1493
Reputation: 10139
You can define an ImageView in your layout like this:
<ImageView
android:id="@+id/Image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/Icon" />
This will set the image to be a drawable resource named Icon. You can also set it from C# using the SetImageResource method:
var image = FindViewById<ImageView>(Resource.Id.Image);
image.SetImageResource(Resource.Drawable.Icon);
Depending on where you want to pull the image from there are other methods on ImageView that might help, such as SetImageURI or SetImageDrawable.
Upvotes: 1