Android ImageView widget allows users to display image in android application. ImageView is a UI component which comes with different attribute. In this tutorial, I am going to show how to use ImageView in android application.

Here, I have used two different images and you can see only one image at a time in the screen. If you click next image button you will see new image, likewise if you click previous image button you will see your first image.

How to Add Border to Android ImageView
Load Image from URL (Internet) in Android
How to Rotate an Image in Android

Android Example: How to Display Image in Android

XML Layout File

Let’s start by adding an ImageView and two buttons in your xml layout file. Here is the final content of activity_main.xml file

Java Activity File

In this java activity file, we control on button click event. Following is the final java code of MainActivity.java file.

That’s all. Now, run your ImageView application and click Next Image and Previous Image buttons which will look like screenshot given below.


Android ImageView Example
Anndroid ImageVIew

Android ImageView Example
Android ImageView

Post a Comment

Powered by Blogger.