Example for using Image View in Android 4


In the following example program we can understand how to apply image to image view control of android .Here by i demonstrate a sample program in order to provoke a bit concept of android.In android all the widget can obtain image by means of invoking its source image.By means of it our application user view will be more perfect and attractive.


// Comment
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start">

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/bg_layout"/>

</RelativeLayout>



In the above program i have used relative layout.Usually due to relative layout we can easily make component positioned based on our decision.we can take full control over it.Background property used here in ImageView component helps us to laod the media data in the widget.

Sample Output

 

raja P Web Developer

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...