In this tutorial, I will show you how to add image as a background. See output below.
Here's the code for MainActivity.java
package com.coderzheaven.pack;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
public class ContentViewExample extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Here's the code for Layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="40dp"
android:paddingTop="40dp"
android:src="@drawable/android_3" />
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" >
<RelativeLayout
android:id="@+id/RelativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/et_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/et_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/et_1"
android:ems="10" />
<EditText
android:id="@+id/et_3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/et_2"
android:ems="10" />
<EditText
android:id="@+id/et_4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/et_3"
android:ems="10" />
<EditText
android:id="@+id/et_5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/et_4"
android:ems="10" />
<EditText
android:id="@+id/et_6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/et_5"
android:ems="10" />
<EditText
android:id="@+id/et_7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/et_6"
android:ems="10" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
That's all, Hope this may help you. Happy Coding!
No comments:
Post a Comment