i have problem that when i am using a text view
the text from the list view come over my toolbar
i don't know what to do , please help me
because i want to use later to toolbar for make
search filter .
thanks to all the helpers if you need me to add my style file or something please let me know !
activity xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<ListView
android:id="#+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
</LinearLayout>
custom list xml
<?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:background="#dee2e2">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:layout_marginLeft="10dp">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25dp"
android:text="TextView" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView3"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView4"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView5"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView6"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView7"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView8"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView9"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView10"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView11"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView12"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView13"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView14"
android:layout_marginLeft="10dp" />
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/edit_icon"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<ImageView
android:layout_width="65dp"
android:layout_height="65dp"
android:id="#+id/imageView"
android:src="#drawable/edit_icon"
android:layout_marginBottom="10dp"
android:layout_margin="5dp" />
<ImageView
android:layout_width="65dp"
android:layout_height="65dp"
android:id="#+id/imageView2"
android:src="#drawable/edit_icon"
android:layout_marginBottom="10dp"
android:layout_margin="5dp" />
<ImageView
android:layout_width="65dp"
android:layout_height="65dp"
android:id="#+id/imageView3"
android:src="#drawable/edit_icon"
android:layout_marginBottom="20dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp" />
<ImageView
android:layout_width="65dp"
android:layout_height="65dp"
android:id="#+id/imageView4"
android:src="#drawable/edit_icon"
android:layout_marginBottom="10dp"
android:layout_margin="5dp" />
<ImageView
android:layout_width="65dp"
android:layout_height="65dp"
android:id="#+id/imageView5"
android:src="#drawable/edit_icon"
android:layout_marginBottom="10dp"
android:layout_margin="5dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Related
I am trying to presnt the text that was back from the server on the UI. i succedd to get the data but for some reason my date (textViewDate) is not begin with the other lines such as place (textViewPlace) and time (textViewTime).
how can i align it in a proper way?
this is my xml code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/relativlayoutGcmMessage"
android:background="#ffffff">
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is the message"
android:textSize="20sp"
android:layout_below="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_above="#+id/textViewloc" />
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_marginTop="20dp"
android:layout_below="#+id/separatorDown"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button android:text="Join"
android:id="#+id/ButtonJoin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#606060"
android:layout_below="#+id/linearLayoutBtn"
android:layout_toRightOf="#+id/textViewUser"
android:layout_toEndOf="#+id/textViewUser">
</Button>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorUp"
android:visibility="visible"
android:background="#FF0000"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorDown"
android:visibility="visible"
android:background="#FF0000"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User ,"
android:id="#+id/textViewUser"
android:layout_below="#+id/separatorUp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:textSize="20sp"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="When:"
android:id="#+id/textViewWhen"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_above="#+id/separatorDown"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="45dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_marginLeft="40dp"
android:layout_alignTop="#+id/textViewWhen"
android:layout_toRightOf="#+id/textViewUser"
android:layout_toEndOf="#+id/textViewUser" />
<Button android:text="Deny"
android:id="#+id/ButtonDeny"
android:layout_width="361dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="#ffffff"
android:background="#606060"
android:layout_below="#+id/linearLayoutBtn"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</Button>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Between:"
android:id="#+id/textViewbtwn"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_below="#+id/textViewDate"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:id="#+id/textViewtime"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_below="#+id/textViewDate"
android:layout_toRightOf="#+id/textViewbtwn"
android:layout_toEndOf="#+id/textViewbtwn" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location:"
android:id="#+id/textViewloc"
android:layout_above="#+id/textViewWhen"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="place"
android:id="#+id/textViewPlace"
android:layout_above="#+id/textViewDate"
android:layout_alignLeft="#+id/textViewtime"
android:layout_alignStart="#+id/textViewtime"
android:textSize="20sp" />
</RelativeLayout>
this is how its look like on my device:
Add this layoute Like this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_alignTop="#+id/textViewWhen"
android:layout_toRightOf="#+id/textViewUser"
android:layout_toEndOf="#+id/textViewUser" />
in This code has Remove This Line..
android:layout_marginLeft="40dp"
I think its Work.
Use a Table layout
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="place"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="When:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Between:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
/>
</TableRow>
</TableLayout>
Also remove the margin property from DATE text.
I am trying to line up the text and images next to each other in a perfect line but cant quite get it center.
As you see with the image it's almost center next to each other but not perfectly what am I missing
<?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:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textView1"
android:textSize="14dp"
android:textStyle="bold"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<ImageView
android:id="#+id/imageView1"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/textView1"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image_ls"
/>
<TextView
android:id="#+id/textView2"
android:textSize="14dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_toRightOf="#+id/imageView1"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
/>
<ImageView
android:id="#+id/imageView2"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/textView2"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image_ls"
/>
<TextView
android:id="#+id/textView3"
android:layout_toRightOf="#+id/imageView2"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:textSize="14dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp">
<TextView
android:id="#+id/textView1"
android:textSize="14dp"
android:textStyle="bold"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<ImageView
android:id="#+id/imageView1"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="#drawable/image_ls" />
<TextView
android:id="#+id/textView2"
android:textSize="14dp"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="TextView" />
<ImageView
android:id="#+id/imageView2"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="#drawable/image_ls" />
<TextView
android:id="#+id/textView3"
android:textSize="14dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="TextView" />
</LinearLayout>
Try This Code:-
<?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:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textView1"
android:textSize="14dp"
android:textStyle="bold"
android:gravity="center"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<ImageView
android:id="#+id/imageView1"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/textView1"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image_ls"
/>
<TextView
android:id="#+id/textView2"
android:textSize="14dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_toRightOf="#+id/imageView1"
android:layout_centerVertical="true"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
/>
<ImageView
android:id="#+id/imageView2"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/textView2"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image_ls"
/>
<TextView
android:id="#+id/textView3"
android:layout_toRightOf="#+id/imageView2"
android:layout_centerVertical="true"
android:gravity="center_vertical|right"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:textSize="14dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
/>
</RelativeLayout>
<?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:gravity="center" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|right"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
Try this:
Use LinearLayout to fix android widgets in vertical or horizontal.
<?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:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="#drawable/ic_launcher" />
I am displaying text and images in a list format next to each other but I can't get them to line up perfectly center next to each other in a straight line what am I missing
Here is my layout code below
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold"
android:layout_gravity="center|right"
android:gravity="center|right"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/textView1"
android:layout_gravity="center|right"
android:gravity="center|right"
android:src="#drawable/image_ls"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|right"
android:text="TextView"
android:textSize="14dp"
android:layout_toRightOf="#+id/imageView1"
android:textStyle="bold"
android:gravity="center|right"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_gravity="center|right"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/textView2"
android:src="#drawable/image_ls"
android:gravity="center|right"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
</RelativeLayout>
This does work:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="5dp"
android:gravity="center_vertical|center_horizontal"
android:background="#color/gray_dark">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="TextView"
android:textSize="14dp"
android:textStyle="bold"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:layout_marginLeft="5dp"
/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="#+id/textView1"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:src="#drawable/image_ls"
android:layout_marginLeft="5dp"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|right"
android:text="TextView"
android:textSize="14dp"
android:layout_toRightOf="#+id/imageView1"
android:textStyle="bold"
android:gravity="center_vertical|right"
android:layout_marginLeft="5dp"
/>
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="#+id/textView2"
android:src="#drawable/image_ls"
android:layout_gravity="center_vertical|right"
android:gravity="center_vertical|right"
android:layout_marginLeft="5dp"
/>
</RelativeLayout>
i would prefer a linear layout over relative for this situation with this simple layout design, it is easier and straight forward you just need to use:
android:layout_gravity="center_vertical"
and play around with weights if any other size restriction is required.
here is the solution hope its what you need:
<?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"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
/>
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="#drawable/ic_launcher"
android:layout_marginTop="10dp"
/>
</LinearLayout>
</LinearLayout>
I am having a weird issue that I am not sure how to fix. I have a RelativeLayout inside a ScrollView and this scrollView has it's height set to fill_parent. So does the RelativeLayout. Still, the contents are not filling the entire screen and it's going only to the wrap_content of the last layout inside this RelativeLayout.
Here is my code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.pontai"
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/relativeLayout3"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/relativeLayout5"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="How much points you have here:"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textViewTotalPoints1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="120"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_alignLeft="#+id/relativeLayout3"
android:layout_below="#+id/linearLayout1"
android:layout_marginTop="5dp"
android:layout_toLeftOf="#+id/textView7"
android:orientation="vertical" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="Ratings"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textViewPositivePoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_below="#+id/textView3"
android:layout_toLeftOf="#+id/textView3"
android:src="#drawable/thumbs_up_focused" />
<TextView
android:id="#+id/textViewNegativePoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView3"
android:layout_centerVertical="true"
android:layout_marginRight="3dp"
android:text="22"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textViewNegativePoints"
android:layout_alignBottom="#+id/textViewNegativePoints"
android:layout_alignLeft="#+id/textView3"
android:layout_marginLeft="3dp"
android:text="33"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignTop="#+id/imageView2"
android:layout_toRightOf="#+id/textViewNegativePoints"
android:src="#drawable/thumbs_down_focused" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout5"
android:layout_width="95dp"
android:layout_height="80dp"
android:layout_alignRight="#+id/relativeLayout3"
android:layout_alignTop="#+id/relativeLayout4"
android:layout_toRightOf="#+id/textView7"
android:orientation="vertical" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="Comments"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="#drawable/speech_bubble" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeLayout4"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" >
<TextView
android:id="#+id/textViewOfferName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Offer Name"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textViewBusinessName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:text="Business Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textViewBusinessAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:text="Business Address"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textViewNull1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="80dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textViewTotalPoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textViewNull1"
android:layout_centerHorizontal="true"
android:text="0/0"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/buttonUseNow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textViewTotalPoints"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="#string/offer_details_use_now" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/buttonUseNow"
android:layout_marginTop="10dp"
android:text="#string/_terms_and_conditions_"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textViewTermsConditions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView2"
android:layout_marginTop="2dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/relativeLayout5"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:text="e"
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="invisible" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Anyone have ideas of how I can make the RelativeLayout2 to have the same height as the ScrollView, meaning, I want it to reach the bottom of the screen?
Thanks and regards,
Felipe
I have faced this problem before. Just Use android:fillViewport="true" in your scrollview and it will fill up the screen.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
I have the following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="#+navigate/RLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ABABAB"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:id="#+id/myid"
android:layout_centerHorizontal="true"
android:src="#drawable/myid"
android:layout_marginTop="15dp" />.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/firstRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/myid" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold|italic"
android:textColor="#000000"
android:id="#+id/hotelinfos"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_below="#+id/myid"
android:layout_alignLeft="#+id/myid"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:textColor="#000000"
android:id="#+id/hotelname"
android:layout_below="#+id/hotelinfos"
android:layout_alignLeft="#+id/hotelinfos"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/hoteladdress"
android:layout_below="#+id/hotelname"
android:layout_alignLeft="#+id/hotelname"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:id="#+id/hotelphone"
android:layout_below="#+id/hoteladdress"
android:layout_alignLeft="#+id/hoteladdress"
android:layout_marginTop="10dp"
android:textColor="#12C"
android:textStyle="bold|italic"
android:onClick="onClick"
android:clickable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#12C"
android:onClick="onClick"
android:clickable="true"
android:textStyle="bold|italic"
android:id="#+id/hotelemail"
android:layout_below="#+id/hotelphone"
android:layout_alignLeft="#+id/hotelphone"
android:layout_marginTop="10dp"
android:paddingBottom="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/picture"
android:layout_below="#+id/myid"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/SecondRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/firstRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/bookinginfos"
android:layout_below="#+id/firstRectangle"
android:layout_alignLeft="#+id/firstRectangle"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/pnr"
android:layout_below="#+id/bookinginfos"
android:layout_alignLeft="#+id/bookinginfos"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/segmentCode"
android:layout_below="#+id/pnr"
android:layout_alignLeft="#+id/pnr"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkin"
android:layout_below="#+id/segmentCode"
android:layout_alignLeft="#+id/segmentCode"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkout"
android:layout_below="#+id/checkin"
android:layout_alignLeft="#+id/checkin"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/nights"
android:layout_below="#+id/checkout"
android:layout_alignLeft="#+id/checkout"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/roomType"
android:layout_below="#+id/nights"
android:layout_alignLeft="#+id/nights"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/boardBasis"
android:layout_below="#+id/roomType"
android:layout_alignLeft="#+id/roomType"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/paxNames"
android:layout_below="#+id/boardBasis"
android:layout_alignLeft="#+id/boardBasis"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
I would like to scroll in this layout because the last part of the relativelayout is not visible!
But i don't know how to do it.
I tried to add a scrollview but i got the error: scrollview can host only one direct child!
Do you have any tips for me?
Thanks in advance for your help!
ScrollView expects a single child view and in your layout you have 2 TextView.
To make the ScrollView work you have to wrap your TextView in a ViewGroup like LinearLayout or RelativeLayout.
Edited code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent">
<RelativeLayout
android:id="#+navigate/RLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ABABAB"
xmlns:android="http://schemas.android.com/apk/res/android"
>
// ... THE REST OF YOUR CODE
</RelativeLayout>
</ScrollView>
Take this code right over you want the scroll to start:
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
Then end up with when you want to stop it.
Since scrollview can only have a child, the child can be any layout. Be in LinearLayout or RelativeLayout. So it should be something like this. <ScrollView> <RelativeLayout> </RelativeLayout> </ScrollView>
Your code would end up like this
<RelativeLayout
android:id="#+navigate/RLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ABABAB"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ScrollView>
android:id="#+navigate/Scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="#+navigate/RLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:id="#+id/hcorpo"
android:layout_centerHorizontal="true"
android:src="#drawable/hcorpo"
android:layout_marginTop="15dp" />.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/firstRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/hcorpo" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold|italic"
android:textColor="#000000"
android:id="#+id/hotelinfos"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_below="#+id/hcorpo"
android:layout_alignLeft="#+id/hcorpo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:textColor="#000000"
android:id="#+id/hotelname"
android:layout_below="#+id/hotelinfos"
android:layout_alignLeft="#+id/hotelinfos"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/hoteladdress"
android:layout_below="#+id/hotelname"
android:layout_alignLeft="#+id/hotelname"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:id="#+id/hotelphone"
android:layout_below="#+id/hoteladdress"
android:layout_alignLeft="#+id/hoteladdress"
android:layout_marginTop="10dp"
android:textColor="#12C"
android:textStyle="bold|italic"
android:onClick="onClick"
android:clickable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#12C"
android:onClick="onClick"
android:clickable="true"
android:textStyle="bold|italic"
android:id="#+id/hotelemail"
android:layout_below="#+id/hotelphone"
android:layout_alignLeft="#+id/hotelphone"
android:layout_marginTop="10dp"
android:paddingBottom="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/picture"
android:layout_below="#+id/hcorpo"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/SecondRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/firstRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/bookinginfos"
android:layout_below="#+id/firstRectangle"
android:layout_alignLeft="#+id/firstRectangle"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/pnr"
android:layout_below="#+id/bookinginfos"
android:layout_alignLeft="#+id/bookinginfos"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/segmentCode"
android:layout_below="#+id/pnr"
android:layout_alignLeft="#+id/pnr"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkin"
android:layout_below="#+id/segmentCode"
android:layout_alignLeft="#+id/segmentCode"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkout"
android:layout_below="#+id/checkin"
android:layout_alignLeft="#+id/checkin"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/nights"
android:layout_below="#+id/checkout"
android:layout_alignLeft="#+id/checkout"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/roomType"
android:layout_below="#+id/nights"
android:layout_alignLeft="#+id/nights"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/boardBasis"
android:layout_below="#+id/roomType"
android:layout_alignLeft="#+id/roomType"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/paxNames"
android:layout_below="#+id/boardBasis"
android:layout_alignLeft="#+id/boardBasis"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Your last RelativeLayout
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</ScrollView>
</RelativeLayout>
Should look like this instead:
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</RelativeLayout>
</ScrollView>