To set Background Image in Android application



In android you can set background image by means of properties or by xml file.At first you have to include the image file in drawable-mdpi folder. The format of image should be .png format. Then in main activity xml file just add following code.

// 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="match_parent"
android:background="@drawable/a_wallpare">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".MainActivity"/>



</RelativeLayout>



Output Mobile View

raja P Web Developer

1 comment:

Related Posts Plugin for WordPress, Blogger...