i am making android UI (using Relative Layout)in which, i need to set one banner whose size is 306 x 51. i have set it as center of screen. and it getting displayed well in some android mobile screen but when i run in tablet then display is like:
as shown in the image, space are remain left and right side. so what i do for it?
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#drawable/page1_11"
android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_01" android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="match_parent" android:src="#drawable/page1_1"
android:id="#+id/imageView1" android:layout_alignParentLeft="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="Shanesh COLORS App"
android:textSize="13dp" android:textStyle="bold" android:textColor="#49515F"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="#+id/login_rellay_01" android:id="#+id/login_rellay_02"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:src="#drawable/page1_4"
android:id="#+id/imageView1" android:layout_centerHorizontal="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="SIGN IN"
android:textSize="13dp" android:textStyle="bold" android:textColor="#FFFFFF"
android:layout_centerInParent="true" />
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="#drawable/page1_2"
android:layout_centerVertical="true" android:layout_marginLeft="10dp" />
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="#drawable/page1_3"
android:layout_centerVertical="true" android:layout_marginRight="10dp"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_03" android:layout_below="#+id/login_rellay_02"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="match_parent" android:src="#drawable/page1_5"
android:id="#+id/imgv_page1_5" android:layout_alignParentLeft="true" />
<!-- <ImageView android:layout_height="wrap_content" android:layout_below="#+id/imgv_page1_5"
android:layout_marginTop="1dp" android:layout_width="match_parent" android:src="#drawable/page1_6"
android:id="#+id/imgv_page1_6" android:layout_alignParentLeft="true" /> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_03" android:layout_centerInParent="true"
android:layout_below="#+id/login_rellay_02" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="SIGN IN "
android:textSize="13dp" android:id="#+id/login_txvx_dwbnr_1"
android:textStyle="bold" android:textColor="#000000"
android:layout_marginLeft="10dp" android:layout_centerVertical="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="with your "
android:id="#+id/login_txvx_dwbnr_2" android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="13dp" android:layout_centerVertical="true"
android:textColor="#000000" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="Shanesh Colors"
android:id="#+id/login_txvx_dwbnr_3" android:layout_toRightOf="#+id/login_txvx_dwbnr_2"
android:textSize="13dp" android:textStyle="bold"
android:layout_centerVertical="true" android:textColor="#000000" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text=" App Account "
android:id="#+id/login_txvx_dwbnr_4" android:layout_toRightOf="#+id/login_txvx_dwbnr_3"
android:textSize="13dp" android:layout_centerVertical="true"
android:textColor="#000000" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_04" android:layout_marginTop="1dp"
android:gravity="center" android:layout_below="#+id/login_rellay_03"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="180dp"
android:layout_width="306dp" android:background="#FFFFFF" android:id="#+id/imgv_page1_6"
android:layout_centerInParent="true" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_04" android:layout_width="match_parent"
android:layout_height="wrap_content" android:gravity="center">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="User Name:"
android:id="#+id/login_txvx_dwbnr_5" android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="11dp" android:layout_centerVertical="true"
android:textColor="#49515F" />
<EditText android:layout_height="40dp" android:layout_width="220dp"
android:layout_marginTop="10dp" android:layout_toRightOf="#+id/login_txvx_dwbnr_5" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_05" android:layout_width="match_parent"
android:layout_height="wrap_content" android:gravity="center"
android:layout_below="#+id/login_rellay_04">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text=" Password:"
android:id="#+id/login_txvx_dwbnr_5"
android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="11dp"
android:layout_centerVertical="true"
android:textColor="#49515F" />
<EditText android:layout_height="40dp" android:layout_width="220dp"
android:layout_alignParentTop="true" android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/login_txvx_dwbnr_5" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_06"
android:layout_marginTop="3dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_below="#+id/login_rellay_05"
android:layout_width="match_parent">
<TextView android:layout_height="wrap_content"
android:textColor="#000000"
android:text="No Account?"
android:textStyle="bold"
android:textSize="11dp"
android:id="#+id/login_txvx_dwbnr_9"
android:layout_width="wrap_content"/>
<TextView android:text="Sign Up"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/login_txvx_signup_account"
android:textColor="#8891A2"
android:textStyle="bold"
android:layout_toRightOf="#+id/login_txvx_dwbnr_9"
android:textSize="11dp"
/></RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_07"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_below="#+id/login_rellay_06"
android:layout_width="match_parent">
<CheckBox android:layout_height="wrap_content"
android:id="#+id/checkBox1"
android:layout_below="#+id/login_txvx_signup_account"
android:layout_width="wrap_content"
android:textColor="#49515F"
android:textSize="11dp"
android:layout_marginLeft="10dp"
android:text=" Remember User Name and Password?"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_08"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="60dp"
android:layout_below="#+id/login_rellay_04"
android:layout_width="match_parent">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="#drawable/page1_8"
/>
</RelativeLayout>
</RelativeLayout>
#zam664 is right ... u should never use fixed widths for Layouts.. try managing them by padding, margins etc.
Use LinearLayout too to manage horizontal children with non-fixed width..
anyway... i modified ur xml a little ... i could not test it fully as i did not have the images/resources u have used in it.. but give it a try.
Replace the whole xml with the following. ...
Note: a have just changed it a little to give you idea ... u should modify it further if that works
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#drawable/page1_11"
android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_01" android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="match_parent" android:src="#drawable/page1_1"
android:id="#+id/imageView1" android:layout_alignParentLeft="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="Shanesh COLORS App"
android:textSize="13dp" android:textStyle="bold" android:textColor="#49515F"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="#+id/login_rellay_01" android:id="#+id/login_rellay_02"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:src="#drawable/page1_4"
android:id="#+id/imageView1" android:layout_centerHorizontal="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="SIGN IN"
android:textSize="13dp" android:textStyle="bold" android:textColor="#FFFFFF"
android:layout_centerInParent="true" />
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="#drawable/page1_2"
android:layout_centerVertical="true" android:layout_marginLeft="10dp" />
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="#drawable/page1_3"
android:layout_centerVertical="true" android:layout_marginRight="10dp"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_03" android:layout_below="#+id/login_rellay_02"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="match_parent" android:src="#drawable/page1_5"
android:id="#+id/imgv_page1_5" android:layout_alignParentLeft="true" />
<!-- <ImageView android:layout_height="wrap_content" android:layout_below="#+id/imgv_page1_5"
android:layout_marginTop="1dp" android:layout_width="match_parent" android:src="#drawable/page1_6"
android:id="#+id/imgv_page1_6" android:layout_alignParentLeft="true" /> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_03" android:layout_centerInParent="true"
android:layout_below="#+id/login_rellay_02" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="SIGN IN "
android:textSize="13dp" android:id="#+id/login_txvx_dwbnr_1"
android:textStyle="bold" android:textColor="#000000"
android:layout_marginLeft="10dp" android:layout_centerVertical="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="with your "
android:id="#+id/login_txvx_dwbnr_2" android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="13dp" android:layout_centerVertical="true"
android:textColor="#000000" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="Shanesh Colors"
android:id="#+id/login_txvx_dwbnr_3" android:layout_toRightOf="#+id/login_txvx_dwbnr_2"
android:textSize="13dp" android:textStyle="bold"
android:layout_centerVertical="true" android:textColor="#000000" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text=" App Account "
android:id="#+id/login_txvx_dwbnr_4" android:layout_toRightOf="#+id/login_txvx_dwbnr_3"
android:textSize="13dp" android:layout_centerVertical="true"
android:textColor="#000000" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_04" android:layout_marginTop="1dp"
android:gravity="center" android:layout_below="#+id/login_rellay_03"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="fill_parent"
android:layout_width="fill_parent" android:background="#FFFFFF" android:id="#+id/imgv_page1_6"
android:layout_centerInParent="true" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_04" android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:paddingLeft="10dp" android:paddingRight="10dp">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="User Name:"
android:id="#+id/login_txvx_dwbnr_5" android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="11dp" android:layout_centerVertical="true"
android:textColor="#49515F" />
<EditText android:layout_height="40dp" android:layout_width="fill_parent" android:layout_weight="1"
android:layout_marginTop="10dp" android:layout_marginLeft="10dp"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_05" android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:paddingLeft="10dp" android:paddingRight="10dp"
android:layout_below="#+id/login_rellay_04">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text=" Password:"
android:id="#+id/login_txvx_dwbnr_5"
android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="11dp"
android:layout_centerVertical="true"
android:textColor="#49515F" />
<EditText android:layout_height="40dp" android:layout_width="fill_parent" android:layout_weight="1"
android:layout_alignParentTop="true" android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/login_txvx_dwbnr_5" />
</LinearLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_06"
android:layout_marginTop="3dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_below="#+id/login_rellay_05"
android:layout_width="match_parent">
<TextView android:layout_height="wrap_content"
android:textColor="#000000"
android:text="No Account?"
android:textStyle="bold"
android:textSize="11dp"
android:id="#+id/login_txvx_dwbnr_9"
android:layout_width="wrap_content"/>
<TextView android:text="Sign Up"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/login_txvx_signup_account"
android:textColor="#8891A2"
android:textStyle="bold"
android:layout_toRightOf="#+id/login_txvx_dwbnr_9"
android:textSize="11dp"
/></RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_07"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_below="#+id/login_rellay_06"
android:layout_width="match_parent">
<CheckBox android:layout_height="wrap_content"
android:id="#+id/checkBox1"
android:layout_below="#+id/login_txvx_signup_account"
android:layout_width="wrap_content"
android:textColor="#49515F"
android:textSize="11dp"
android:layout_marginLeft="10dp"
android:text=" Remember User Name and Password?"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_08"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="60dp"
android:layout_below="#+id/login_rellay_04"
android:layout_width="match_parent">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="#drawable/page1_8"
/>
</RelativeLayout>
You cannot used fixed dimensions if your aspect ratio or screen sizes are expected to vary. That is why Java focused on layout managers to be more platform agnostic than previous Windows development methods which forced dimensions. Forced dimensions are bad.
This is because your tablet width is more than 306. so the banner is showing at center of the screen but taking width required for the banner image. try following
you are using
android:layout_width="wrap_content"
for ImageView in which you are setting your banner
please try using
android:layout_width="match_parent"
instead. Another way is try to put big size banner image in /drawable-xlarge folder to match your tablet screen size
Related
I have item_list.xml of ListView in side of Activity
Layout shown perfect in Graphical Layout
here put item_list.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#5F8295" >
<LinearLayout
android:id="#+id/imageview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageView
android:id="#+id/mImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/android_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/compliance"
android:layout_toRightOf="#+id/imageview"
android:orientation="vertical" >
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="TITLE"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textSize="30sp" />
<TextView
android:id="#+id/txtNoofTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="Text"
android:textColor="#fff"
android:textSize="18sp" />
<TextView
android:id="#+id/txtDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="Other Details for User"
android:textColor="#fff"
android:textSize="18sp" />
<TextView
android:id="#+id/txtExtraDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="Extra Description"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/compliance"
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="#FF0000"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/empty" // transparent png image 10x10
/>
</LinearLayout>
</RelativeLayout>
It shown in screen as per below image
I want output as per below image
I dont understand why my color layout not showing its height = "match_parent"
change your layout to some thing like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rightBg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="#5F8295" >
<LinearLayout
android:id="#+id/imageview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageView
android:id="#+id/mImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/compliance"
android:layout_toRightOf="#+id/imageview"
android:orientation="vertical" >
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="TITLE"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textSize="30sp" />
<TextView
android:id="#+id/txtNoofTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="Text"
android:textColor="#fff"
android:textSize="18sp" />
<TextView
android:id="#+id/txtDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="Other Details for User"
android:textColor="#fff"
android:textSize="18sp" />
<TextView
android:id="#+id/txtExtraDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:singleLine="true"
android:text="Extra Description"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
you need to change background color of rightBg id in your getView() method
result:
I am trying to create an layout as shown in the figure.
In that image shipped to is attached to the border of the layout. how to overlap like that.
Here is the XML I am using to create that
<RelativeLayout
android:id="#+id/shipped_to_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/address_blue_border" >
<TextView
android:id="#+id/tv_shipped_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/homebackground"
android:text="Shipped To"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/tv_door_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_shipped_to"
android:text="22"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/tv_address_line1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_door_no"
android:text="Delhi, India"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/tv_address_line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_address_line1"
android:text="Swindon Senegal BS32 8FE"
android:textColor="#android:color/black" />
</RelativeLayout>
Try this
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="8dp"
android:background="#android:color/holo_blue_bright"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="#+id/tv_door_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="22" />
<TextView
android:id="#+id/tv_address_line1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delhi" />
<TextView
android:id="#+id/tv_address_line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Some more dara" />
</LinearLayout>
<TextView
android:id="#+id/tv_shipped_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Ship To"
android:background="#android:color/holo_blue_dark"
android:layout_marginLeft="15dp"
/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#android:color/white">
<!-- This is the main content -->
<RelativeLayout
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_margin="15dp" android:background="#drawable/frame"
android:orientation="vertical" android:padding="20dp">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Main Content" android:layout_centerInParent="true" />
</RelativeLayout>
<!-- This is the title label -->
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="#android:color/white" android:padding="5dp"
android:text="Testing"
android:layout_marginLeft="30dp" android:textColor="#android:color/black" />
</RelativeLayout>
You can have your answer at here and here
To obtain a layout similar to the one it's in the image you have to use command android:layout_margin with negative values.
Here is an example:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="TextView" />
</RelativeLayout>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/relativeLayout1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="-10dp"
android:text="TextView" />
</RelativeLayout>
Your image is a bit toooo small. Anyway, for that, use RelativeLayout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="20dp"
android:background="#ccff00"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<!-- Your other TextViews -->
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="#ccffff"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
i am implementing one data enter screen with many fields.so that i am using scrolling view in my layout.But i want to draw OK button always.but i am unable to lock the some part of the screen.
i need secreen as:
but i am getting picture as either
or
i am adding my layout code below(as shown in last pic) plesae help me .
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#2E9AFE" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Present Details"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColorHint="#350924"
android:textStyle="bold" />
<TextView
android:id="#+id/tvtv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Present Location"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#350924"
android:textStyle="bold" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<EditText
android:id="#+id/etPreLoc1"
android:layout_width="fill_parent"
android:layout_height="120dp"
android:layout_gravity="center"
android:ems="10"
android:hint="Where are u now?"
android:inputType="textPostalAddress" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/etPreLoc1"
android:layout_gravity="center"
android:text="Coming By"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#350924"
android:textStyle="bold" />
<EditText
android:id="#+id/mmsComing"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ems="10"
android:hint="car/auto/other" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Vehicle details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#350924"
android:textStyle="bold" />
<EditText
android:id="#+id/etDriver"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ems="10"
android:hint="Driver name/vehicle no"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Expected time to reach by:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#350924"
android:textStyle="bold" />
<TimePicker
android:id="#+id/timePicker2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_weight="75" />
</LinearLayout>
</ScrollView>
<Button
android:id="#+id/mmsOk"
android:layout_width="fill_parent"
android:layout_height="64dp"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:layout_weight="25"
android:background="#drawable/blackbutton"
android:text="OK"
android:textColor="#android:color/white"
android:textSize="32dp"
android:textStyle="bold" />
</LinearLayout>
You can do that with a RelativeLayout like that. Just put all you views in the linearlayout inside the scrollview.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" >
<Button
android:id="#+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
Change scrollview height to 0dp and give weight as 1.
Change button layout gravity to bottom instead of center.
i tried designing an xml layout for my android app. It looks good in eclipse graphical layout of android api level 10. But when i run the same in my android device of 2.3.3(api level 10),
that layout looks completely different.
After the text title in the top everything gets changed
I have attached the screen shot of my graphical layout in eclipse and image from my android device
Following is my xml file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/frame2_include"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#drawable/bg">
<LinearLayout
android:id="#+id/title_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top">
<include
android:id="#+id/title_include"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="#layout/title" />
</LinearLayout>
<RelativeLayout
android:id="#+id/r_title_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/title_bg">
<TextView
android:id="#+id/normal_title_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/app"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/r_frame_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/r_title_layout">
<ViewSwitcher
android:id="#+id/r_frame_viewSwitcher1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/r_frame_image_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="7dp"
android:background="#color/white"
android:layout_gravity="center_vertical">
<RelativeLayout
android:id="#+id/r_round_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/points_bg" >
<LinearLayout
android:id="#+id/r_center_frame_img_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<TextView
android:id="#+id/r_frame_img_txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:text="50"
android:textColor="#000000"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/r_frame_img_txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Points"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/r_frame_map_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
android:id="#+id/parii_me_map_view2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
layout="#layout/parii_map" />
</LinearLayout>
</ViewSwitcher>
<RelativeLayout
android:id="#+id/r_merge_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="105dp"
android:background="#android:color/transparent">
<ImageView
android:contentDescription="#string/app_name"
android:id="#+id/merge_bg_img"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/title_bg"
android:layout_centerInParent="true"/>
<RelativeLayout
android:id="#+id/merge_view_pro_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/merge_center_img"
android:layout_centerVertical="true">
<TextView
android:id="#+id/merge_view_pro_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/mrg_profile"
android:layout_centerInParent="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<ImageView
android:contentDescription="#string/app_name"
android:id="#+id/merge_center_img"
android:layout_width="73dp"
android:layout_height="73dp"
android:layout_centerInParent="true"
android:background="#drawable/ic_launcher" />
<RelativeLayout
android:id="#+id/merge_view_cash_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/merge_center_img"
android:layout_centerVertical="true">
<TextView
android:id="#+id/merge_view_cash_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/mrg_cash"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/r_edit_box_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="185dp">
<TextView
android:id="#+id/r_remaining_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="7dp"
android:layout_marginRight="3dp"
android:gravity="center|center_horizontal"
android:text="200"
android:textColor="#color/black"
android:background="#drawable/ponts_field"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/r_remaining_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/r_remaining_label"
android:text="#string/Reamins"
android:layout_centerVertical="true"
android:textColor="#color/black"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/r_points_txt"
android:layout_toLeftOf="#+id/r_points_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Parii_Pts"
android:layout_centerVertical="true"
android:gravity="center"
android:textColor="#color/black"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/r_points_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="7dp"
android:layout_marginLeft="3dp"
android:text="100"
android:gravity="center|center_horizontal"
android:textColor="#color/black"
android:background="#drawable/ponts_field"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="#+id/r_items_viewed_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_below="#+id/r_frame_layout"
android:maxLines="2"
android:textColor="#color/black"
android:textAppearance="?android:attr/textAppearanceSmall" />
<RelativeLayout
android:id="#+id/r_bottom_map_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/r_items_viewed_txt"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/r_valid_date"
android:layout_toLeftOf="#+id/r_points_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageButton
android:contentDescription="#string/app_name"
android:id="#+id/parii_me_details_switch_mapBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:layout_centerVertical="true"
android:background="#drawable/map_sel_btn" />
</RelativeLayout>
</FrameLayout>
Pls say me where i am going wrong
try this:
only replace that by default image by your circle image having 50 pts inside.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#aba4a4">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/l1">
<Button
android:id="#+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Back btn"
android:textColor="#121212"
android:textSize="18dp" />
<TextView
android:id="#+id/txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Rewards"
android:textColor="#android:color/black"
android:textSize="18dp"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/l2"
android:layout_below="#+id/l1"
android:background="#7d7373">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="18dp"
android:layout_centerHorizontal="true"
android:textColor="#android:color/white"/>
</RelativeLayout>
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_below="#+id/l2"
android:background="#drawable/ic_launcher"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/l3"
android:background="#7d7373"
android:layout_centerInParent="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Profile"
android:textSize="18dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="View"
android:textSize="18dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:layout_marginRight="20dp"/>
</RelativeLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"
android:layout_centerInParent="true"/>
</RelativeLayout>
Add the remaining view in it.i think this must solve your issue.
Hello I need to set scroll view in following code,and set after first relative layout but it gives me :
main.xml: IllegalStateException: ScrollView can host only one direct child
that means i cant use scrollview in multiple layout child.So how can i use scroll view inside first relative layout and cover with all inner relative layout.
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#drawable/page1_11"
android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_01" android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="match_parent" android:src="#drawable/page1_1"
android:id="#+id/imageView1" android:layout_alignParentLeft="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="Shanesh COLORS App"
android:textSize="13dp" android:textStyle="bold" android:textColor="#49515F"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="#+id/login_rellay_01" android:id="#+id/login_rellay_02"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:src="#drawable/page1_4"
android:id="#+id/imageView1" android:layout_centerHorizontal="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="SIGN IN"
android:textSize="13dp" android:textStyle="bold" android:textColor="#FFFFFF"
android:layout_centerInParent="true" />
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="#drawable/page1_2"
android:layout_centerVertical="true" android:layout_marginLeft="10dp" />
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="#drawable/page1_3"
android:layout_centerVertical="true" android:layout_marginRight="10dp"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_03" android:layout_below="#+id/login_rellay_02"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="match_parent" android:src="#drawable/page1_5"
android:id="#+id/imgv_page1_5" android:layout_alignParentLeft="true" />
<!-- <ImageView android:layout_height="wrap_content" android:layout_below="#+id/imgv_page1_5"
android:layout_marginTop="1dp" android:layout_width="match_parent" android:src="#drawable/page1_6"
android:id="#+id/imgv_page1_6" android:layout_alignParentLeft="true" /> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_03" android:layout_centerInParent="true"
android:layout_below="#+id/login_rellay_02" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="SIGN IN "
android:textSize="13dp" android:id="#+id/login_txvx_dwbnr_1"
android:textStyle="bold" android:textColor="#000000"
android:layout_marginLeft="10dp" android:layout_centerVertical="true" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="with your "
android:id="#+id/login_txvx_dwbnr_2" android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="13dp" android:layout_centerVertical="true"
android:textColor="#000000" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="Shanesh Colors"
android:id="#+id/login_txvx_dwbnr_3" android:layout_toRightOf="#+id/login_txvx_dwbnr_2"
android:textSize="13dp" android:textStyle="bold"
android:layout_centerVertical="true" android:textColor="#000000" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text=" App Account "
android:id="#+id/login_txvx_dwbnr_4" android:layout_toRightOf="#+id/login_txvx_dwbnr_3"
android:textSize="13dp" android:layout_centerVertical="true"
android:textColor="#000000" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_04" android:layout_marginTop="1dp"
android:gravity="center" android:layout_below="#+id/login_rellay_03"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:layout_height="180dp"
android:layout_width="306dp" android:background="#FFFFFF" android:id="#+id/imgv_page1_6"
android:layout_centerInParent="true" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_04" android:layout_width="match_parent"
android:layout_height="wrap_content" android:gravity="center">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:text="User Name:"
android:id="#+id/login_txvx_dwbnr_5" android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="11dp" android:layout_centerVertical="true"
android:textColor="#49515F" />
<EditText android:layout_height="40dp" android:layout_width="220dp"
android:layout_marginTop="10dp" android:layout_toRightOf="#+id/login_txvx_dwbnr_5" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_05" android:layout_width="match_parent"
android:layout_height="wrap_content" android:gravity="center"
android:layout_below="#+id/login_rellay_04">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text=" Password:"
android:id="#+id/login_txvx_dwbnr_5"
android:layout_toRightOf="#+id/login_txvx_dwbnr_1"
android:textSize="11dp"
android:layout_centerVertical="true"
android:textColor="#49515F" />
<EditText android:layout_height="40dp" android:layout_width="220dp"
android:layout_alignParentTop="true" android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/login_txvx_dwbnr_5" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_06"
android:layout_marginTop="3dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_below="#+id/login_rellay_05"
android:layout_width="match_parent">
<TextView android:layout_height="wrap_content"
android:textColor="#000000"
android:text="No Account?"
android:textStyle="bold"
android:textSize="11dp"
android:id="#+id/login_txvx_dwbnr_9"
android:layout_width="wrap_content"/>
<TextView android:text="Sign Up"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/login_txvx_signup_account"
android:textColor="#8891A2"
android:textStyle="bold"
android:layout_toRightOf="#+id/login_txvx_dwbnr_9"
android:textSize="11dp"
/></RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_07"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_below="#+id/login_rellay_06"
android:layout_width="match_parent">
<CheckBox android:layout_height="wrap_content"
android:id="#+id/checkBox1"
android:layout_below="#+id/login_txvx_signup_account"
android:layout_width="wrap_content"
android:textColor="#49515F"
android:textSize="11dp"
android:layout_marginLeft="10dp"
android:text=" Remember User Name and Password?"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_rellay_08"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="60dp"
android:layout_below="#+id/login_rellay_04"
android:layout_width="match_parent">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="#drawable/page1_8"
/>
</RelativeLayout>
</RelativeLayout>
You make the outer most element the scrollview, which will give only one child your top-level relativelayout.