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.
Related
I want to achieve like the image below
And I tried, but it is not my desired result.
Below is my xml
<?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="wrap_content"
android:orientation="horizontal"
android:padding="5dip">
<LinearLayout android:id="#+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip">
<ImageView
android:id="#+id/photo"
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="centerCrop"
android:layout_gravity="center"/>
</LinearLayout>
<TextView
android:id="#+id/ListDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/input_register"
android:text="Date"
android:layout_marginLeft="150dp"
android:layout_alignTop="#+id/thumbnail"
android:layout_toRightOf="#+id/thumbnail" />
<TextView
android:id="#+id/ListDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="20sp"
android:text="Description"
android:ellipsize="end"
android:textStyle="bold"
android:layout_below="#id/ListDate"
android:layout_toRightOf="#+id/thumbnail" />
<TextView
android:id="#+id/ListAmount"
android:text="Amount"
android:layout_marginTop="40dp"
android:layout_marginLeft="166dp"
android:textSize="20sp"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_toRightOf="#+id/thumbnail"
android:textColor="#color/violetred" />
</RelativeLayout>
How can I write the ... beside the Amount TextView same like the first image I post ? Any help is much appreciated.
You can have only one layout which will solve your problem nesting is not a good idea.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textColor="#000"
android:layout_gravity="center"
android:textSize="?android:actionBarItemBackground"
android:textStyle="bold"
android:text="8 hours # $80.00/hour"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="2014-05-08"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/activity_horizontal_margin"
android:textStyle="bold"
android:layout_gravity="end"
android:textColor="#000"
android:textSize="?android:actionBarItemBackground"
android:text="$640.00"/>
</FrameLayout>
you can achieve your requirement with this xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#d8d8d8" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#c8c8c8"
android:src="#drawable/ic_launcher" >
</ImageView>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:text="TextView"
android:textColor="#000000" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="6dp"
android:layout_marginTop="20dp"
android:padding="2dp"
android:text="2014-05-08"
android:textColor="#000000" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView2"
android:layout_marginRight="6dp"
android:layout_marginTop="20dp"
android:padding="2dp"
android:text="$600"
android:textColor="#000000"
android:textStyle="bold" />
</RelativeLayout>
hope this helps you.exact xml of you want to achieve.
<?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="wrap_content"
android:orientation="horizontal"
android:padding="5dip">
<ImageView
android:id="#+id/photo"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:padding="3dp"
android:scaleType="centerCrop"
android:layout_gravity="center"/>
<TextView
android:id="#+id/ListDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/right_container"
android:singleLine="true"
android:textSize="20sp"
android:text="Description"
android:ellipsize="end"
android:textStyle="bold"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/photo" />
<LinearLayout
android:id="#+id/right_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:orientation="vertical">
<TextView
android:id="#+id/ListDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#color/input_register"
android:text="12-11-2017"
android:layout_marginRight="10dp"/>
<TextView
android:id="#+id/ListAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="777$"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:textSize="20sp"
android:textColor="#color/violetred" />
</LinearLayout>
Use constraint layout for best performance. If not, use horizontal linear layout, with weight on the center one.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="5dip">
<ImageView
android:id="#+id/photo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#color/black"
android:scaleType="centerCrop" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:text="Buy drinks fvbfvfvfvasdasdasdfvfvvfvf" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="1014-05-08" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="$6969"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.5"
android:ellipsize="end"
android:maxLines="1"
android:text="ASASJHGHHBHHJHJNKMKIKMKMKMKMKKNIKNIJ" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2016-01-11" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="$640"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="5dip">
<LinearLayout android:id="#+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:weightSum=".20"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip">
<ImageView
android:id="#+id/photo"
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="centerCrop"
android:layout_gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum=".80"
android:layout_alignRight="#+id/thumbnail"
android:layout_alignParentRight="true"
android:orientation="vertical">
<TextView
android:id="#+id/ListDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginRight="10dp"
android:textColor="#color/input_register"
android:text="Date"
/>
<TextView
android:id="#+id/ListDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_marginRight="10dp"
android:textSize="20sp"
android:text="DescriptionDescriptionDescriptionDescription"
android:ellipsize="end"
android:textStyle="bold"
/>
<TextView
android:id="#+id/ListAmount"
android:text="Amount"
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="end"
android:layout_marginRight="10dp"
android:layout_toRightOf="#+id/thumbnail"
android:textColor="#color/violetred" />
</LinearLayout>
</LinearLayout>
I inflate layout to listview and here is what I want:
But I always get something like this:
As you see, the button is always align at the bottom of parent. Here is my 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="match_parent"
android:layout_height="wrap_content"
android:padding="10dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" >
<ImageView
android:id="#+id/img_icon_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="5dp" />
<TextView
android:id="#+id/txt_title_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/img_icon_type"
android:text="TextView"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_post_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_title_type"
android:layout_marginTop="16dp"
android:layout_toRightOf="#+id/img_icon_type"
android:text="TextView"
android:textSize="15sp" />
<TextView
android:id="#+id/txt_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_post_time"
android:layout_toRightOf="#+id/img_icon_type"
android:text="TextView"
android:textSize="15sp" />
<ImageView
android:id="#+id/img_edit_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:onClick="openPostMenu"
android:src="#drawable/btn_memo_menu" />
<TextView
android:id="#+id/txt_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img_icon_type"
android:layout_margin="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="TextView"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_posted"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_below="#+id/txt_status"
android:layout_centerHorizontal="true"
android:src="#drawable/ic_launcher" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/img_posted"
android:layout_alignRight="#+id/img_posted"
android:layout_below="#+id/img_posted" >
<RelativeLayout
android:id="#+id/btn_confirm_route"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:background="#f2f2f2" >
<TextView
android:id="#+id/txt_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/現在地からのル一トを確認" />
<ImageView
android:layout_width="20sp"
android:layout_height="20sp"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/txt_address"
android:src="#drawable/btn_memo_route_search_pressed" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
Please help me to fix this!Thank you!
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 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