Simply Displaying An Image
The ImageView layout component is the base element used for displaying images in Android. Download Any image and copy it into res/layout/drawable-mdpi in your project.
main.xml
<ImageView
android:id="@+id/images"
android:src="@drawable/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
This ImageView loads the any downloaded image you downloaded. Add this to the res/layout/main.xml file below the TextView.
And JAVA Code given below.
package com.tuto.image;
import android.app.Activity;
public class Images Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView image = (ImageView) findViewById(R.id.images);
}
}
All that was added to the default code is how to get the ImageView component from the layout and store it in a variable. We'll do more with this in the next examples.
So this are the simple imageview for displaying in android.
Subscribe to:
Post Comments (Atom)
How to Free Up Storage Space on Your Android Phone (Without Deleting Photos)
Running out of space on your Android phone is one of the most common (and most annoying) problems out there - especially once you start gett...
-
Hello Friends, There are two or many more header listview in android. So Today we are discussed about the two header of android. And See Al...
-
Hello , This is the simple application for play video in android. This video play from raw folder. And this are the simple of basic applicat...
-
According to the Guardian , Google "seriously underestimated" demand for the tablet, particularly the variant with 16GB of stor...
No comments:
Post a Comment