i have a ScrollView in android, inside it i have a RelativeLayout, my problem its the scroll doesnt go to the end and i cant see the last TextView.
This is the XML
<!-- Main layout -->
<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"
tools:context=".TabOrderActivity$OrderDetailFragment"
android:orientation="vertical"
android:background="#drawable/fondodroid2"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:weightSum="1">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue_gg"
android:paddingTop="5dip">
<TextView
android:text="#string/orderDetail"
android:textSize="32sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:orientation="horizontal">
<TextView
android:text="NÂș"
android:textSize="28sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:id="#+id/file"
android:textSize="28sp"
android:layout_marginLeft="20dp"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="10dp"
android:layout_weight="2.16"
android:layout_marginRight="0dp"
android:text="numero de orden" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="#+id/scrollView">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<TextView
android:id="#+id/policyHolderLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/customer"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="24dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:textStyle="bold" />
<TextView
android:id="#+id/policyHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_toRightOf="#+id/policyHolderLabel"
android:gravity="left|top"
android:layout_marginLeft="10dp"
android:textSize="20sp" />
<TextView
android:id="#+id/cityLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/city"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/policyHolder"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/city"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_toRightOf="#+id/cityLabel"
android:gravity="left|top"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/cityLabel" />
<TextView
android:id="#+id/provinceLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/province"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/city"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/province"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/provinceLabel"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/provinceLabel" />
<TextView
android:id="#+id/addressLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:layout_below="#+id/province"
android:layout_alignParentLeft="true"
android:textStyle="bold" />
<TextView
android:id="#+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/addressLabel"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/addressLabel" />
<TextView
android:id="#+id/zipCode"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/addressLabel"
android:layout_below="#+id/address"
android:layout_marginLeft="10dp" />
<TextView
android:id="#+id/phonesLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/phones"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_below="#+id/zipCode"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/phone1"
android:inputType="phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|top"
android:textSize="20sp"
android:layout_toRightOf="#+id/phonesLabel"
android:layout_marginLeft="10dp"
android:layout_alignBottom="#+id/phonesLabel" />
<TextView
android:id="#+id/descriptionLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/description"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/phonesLabel"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descriptionLabel"
android:layout_below="#+id/descriptionLabel"
android:layout_marginTop="10dp"
android:editable="false"
android:inputType="textMultiLine"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="20sp"
android:layout_marginBottom="10dp" />
<TextView
android:id="#+id/coverageLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Cobertura"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/description"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/coverage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/coverageLabel"
android:layout_below="#+id/coverageLabel"
android:layout_marginTop="10dp"
android:editable="false"
android:inputType="textMultiLine"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="20sp"
android:layout_marginBottom="10dp" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
I tried to set a LinearLayout inside scrollview and the linearlayout contains the relative but i got the same result.
Whats wrong?
Try to change the margins to paddings:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
Hope this helps.
Related
i am using scrollview in Linearlayout , the problem is layout respond normally, as soon as i start scrolling, it laggs too much.
< LinearLayout >
< ScrollView >
< Linearlayout >..sub (LinearLayout)..< /LinearLayout >
< ScrollView>
< LinearLayout>
<?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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:orientation="vertical"
android:background="#drawable/round_edittext"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/pddd"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/profile_user_email_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Complete Your profile"
android:textAlignment="center"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:background="#drawable/round_edittext"
android:inputType="textCapSentences"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile : "
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_mobile_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5sp"
android:background="#drawable/round_edittext"
android:inputType="number"
android:maxLength="10"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold"
/>
</LinearLayout>
<RadioButton
android:id="#+id/profile_faculty_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="20sp"
android:text="Faculty"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/profile_parents_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="10sp"
android:text="Parents"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold"
/>
<LinearLayout
android:id="#+id/layout_faculty_key_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="6">
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold"
/>
<EditText
android:id="#+id/pff_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/faculty_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold"
/>
<ImageView
android:id="#+id/faculty_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/proile_activity_unique_key_linearlayout_id"
>
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold"
/>
<EditText
android:id="#+id/profile_activity_school_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold"
/>
<ImageView
android:id="#+id/profile_activity_school_key_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold"
/>
<ImageView
android:id="#+id/profile_activity_school_key_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="20sp"
android:orientation="horizontal"
>
<Spinner
android:id="#+id/activityprofile_spinner_id"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:layout_marginLeft="50sp"
>
</Spinner>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="#+id/profile_saveinfo_id"
android:layout_width="100sp"
android:layout_height="50sp"
android:layout_gravity="center_horizontal"
android:background="#drawable/save2" />
<Button
android:id="#+id/profile_nagivate_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Navigate" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
i have used this code for my Linearlayout, As soon as i touch radioButton or edittext or i scrolldown, It start lagging alot. Im not able to understand the problem, the images i have used are small size below 100kb
I edited your code and took out about 4 LinearLayouts which were unnecessary. Please test it for performance. If it still is slow try substituting some of the remaining vertical LinearLayouts with RelativeLayouts as #IshitaShinha suggested.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/round_edittext"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/pddd"
android:orientation="vertical">
<TextView
android:id="#+id/profile_user_email_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Complete Your profile"
android:textAlignment="center"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:background="#drawable/round_edittext"
android:inputType="textCapSentences"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile : "
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_mobile_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5sp"
android:background="#drawable/round_edittext"
android:inputType="number"
android:maxLength="10"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
</LinearLayout>
<RadioButton
android:id="#+id/profile_faculty_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="20sp"
android:text="Faculty"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/profile_parents_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="10sp"
android:text="Parents"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/layout_faculty_key_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="6">
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/pff_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/faculty_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold" />
<ImageView
android:id="#+id/faculty_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/proile_activity_unique_key_linearlayout_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profile_activity_school_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/profile_activity_school_key_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold" />
<ImageView
android:id="#+id/profile_activity_school_key_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<Spinner
android:id="#+id/activityprofile_spinner_id"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:layout_marginLeft="50sp"
android:layout_marginTop="20sp" />
<Button
android:id="#+id/profile_saveinfo_id"
android:layout_width="100sp"
android:layout_height="50sp"
android:layout_gravity="center_horizontal"
android:background="#drawable/save2" />
<Button
android:id="#+id/profile_nagivate_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Navigate" />
</LinearLayout>
</ScrollView>
I have created a fragment and its xml code is as below:
<RelativeLayout 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"
tools:context="com.unss.pra.b.one_fragment"
android:background="#FFFFFF">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp">
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:id="#+id/textView07"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/dbutton1" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/downloadicon"
android:id="#+id/dbutton1"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView08"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:id="#+id/textView02"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/dbutton2" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/downloadicon"
android:id="#+id/dbutton2"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView05"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:id="#+id/textView04"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/dbutton4" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/downloadicon"
android:id="#+id/dbutton4"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView5"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=" Download"
android:textAlignment="center"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView6"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/dbutton5" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/downloadicon"
android:id="#+id/dbutton5"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView06"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textAlignment="center"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView10"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/dbutton6" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/downloadicon"
android:id="#+id/dbutton6"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView09"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textAlignment="center"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView03"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/dbutton7" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/downloadicon"
android:id="#+id/dbutton7"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Keeping the idea:
Linear/Relative Layout
Scroll View
Linear Layout
//My layouts,
I have put Linear Scroll view, the layout is not getting scrolled. The layout just remains static. Please let me know why.
Try changing your Scrollview to : add android:layout_height="wrap_content"
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
I tried your code, Removed a lot of lines of drawables and project info as it is customized for your own project.
The code is working fine, I can scroll. Maybe the problem lies in the images you are using, High res images sometimes do make your UI unresponsive / freeze. Make sure you look into that too.
I am attaching your code and a snapshot of how it appears to me. Code works fine.
<RelativeLayout 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:background="#FFFFFF">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp">
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:id="#+id/textView07"
android:layout_centerVertical="true"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/dbutton1" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView08"
android:layout_centerVertical="true"
/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:id="#+id/textView02"
android:layout_centerVertical="true" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/dbutton2"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_centerVertical="true"
/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:layout_centerVertical="true" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView05"
android:layout_centerVertical="true"
/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:textAlignment="center"
android:id="#+id/textView04"
android:layout_centerVertical="true" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/dbutton4"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView5"
android:layout_centerVertical="true"
/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=" Download"
android:textAlignment="center"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView6"
android:layout_centerVertical="true"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/dbutton5" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView06"
android:layout_centerVertical="true"
/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textAlignment="center"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView10"
android:layout_centerVertical="true"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="\n"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:layout_weight="2"
android:id="#+id/textView09"
android:layout_centerVertical="true"/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Download"
android:textAlignment="center"
android:textSize="20dp"
android:typeface="serif"
android:textColor="#000000"
android:id="#+id/textView03"
android:layout_centerVertical="true"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
How to fix background image with scrollview when windowSoftInputMode appears.
I used windowSoftInputMode="adjustPan",but scrollview doesn't work
completely, please help me. Last fields do not appear when virtual keyboard
appears.
I want that background image should not scroll up with virtual keyboard
and scrollview should show all the fields inside it while scrolling.
Here is my code
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/back">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cancel_done_btn"
android:layout_marginLeft="30dp"
android:layout_marginTop="40dp"
android:textSize="17dp"
android:paddingTop="10dp"
android:textStyle="bold"
android:paddingBottom="10dp"
android:paddingLeft="28dp"
android:paddingRight="28dp"
android:text="#string/cancel"
android:id="#+id/btn_cancel_signin"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cancel_done_btn"
android:layout_marginRight="30dp"
android:layout_marginTop="40dp"
android:textSize="17dp"
android:text="#string/done"
android:paddingTop="10dp"
android:textStyle="bold"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:layout_alignParentRight="true"
android:id="#+id/btn_done_signin"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:layout_marginLeft="40dp"
android:orientation="vertical"
android:layout_below="#+id/btn_cancel_signin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="times new roman"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Tuesday,May"
android:textSize="25dp"
android:textStyle="bold"
android:id="#+id/tv_day_month" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="times new roman"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=" 7,2016"
android:textSize="25dp"
android:textStyle="bold"
android:id="#+id/tv_date" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="200dp"
android:layout_marginLeft="130dp"
android:layout_below="#+id/btn_cancel_signin">
<ImageView
android:id="#+id/iv_signin_logo"
android:layout_width="200dp"
android:layout_height="180dp"
android:src="#drawable/sign_in_logo"
android:layout_marginTop="10dp" />
</LinearLayout>
<ScrollView
android:layout_width="350dp"
android:layout_height="wrap_content"
android:id="#+id/scroller_sign_in"
android:layout_below="#+id/btn_done_signin"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<LinearLayout
android:orientation="vertical"
android:paddingLeft="10dp"
android:layout_marginRight="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<TextView
android:layout_height="wrap_content"
android:text="First Name"
style="#style/sign_in_text"
android:id="#+id/label_firstname"
android:layout_alignParentLeft="true"
android:paddingTop="10dp"
android:inputType="textCapWords"
/>
<AutoCompleteTextView
android:id="#+id/et_firstname"
android:hint="Required"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
>
<TextView
android:layout_height="wrap_content"
android:text="Last Name"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_lastname"
android:paddingTop="10dp"
android:layout_alignParentLeft="true"
android:inputType="textCapWords"
/>
<AutoCompleteTextView
android:id="#+id/et_lastname"
android:hint="Required"
android:ems="10"
android:textSize="20dp"
android:textAllCaps="true"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_company"
>
<TextView
android:layout_height="wrap_content"
android:text="Company"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:layout_marginTop="10dp"
android:id="#+id/label_company"
android:layout_alignParentLeft="true"
/>
<AutoCompleteTextView
android:id="#+id/et_company"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:textAllCaps="true"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<!--android:background="#drawable/contact_edittext_bg"-->
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_address"
>
<TextView
android:layout_height="wrap_content"
android:text="Address"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_address"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_address"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_city"
>
<TextView
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:layout_height="wrap_content"
android:text="City"
android:id="#+id/label_city"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_city"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_state"
>
<AutoCompleteTextView
android:id="#+id/et_state"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
<TextView
android:layout_height="wrap_content"
android:text="State"
style="#style/sign_in_text"
android:id="#+id/label_state"
android:paddingTop="15dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_zip_code"
>
<TextView
android:layout_height="wrap_content"
android:text="Zip Code"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_zip_code"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_zipcode"
android:ems="10"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:textSize="20dp"
android:padding="10dp"
android:layout_height="wrap_content"
android:inputType="number"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
remove this from xml.
android:background="#drawable/back"
Write in your java file.
getWindow().setBackgroundDrawableResource(R.drawable.back);
I am creating custom tabs which consists of seven tabs using linear layout with imageview and Textview(Child elements) and giving weight equaly to seven tabs. But i need to set first tab width to remaining tabs so that it looks good.How to accompolish this. I am attaching screen shot for your kind reference.
XML File
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:requiresFadingEdge="horizontal"
android:fadingEdgeLength="2dp"
android:scrollbarStyle="outsideInset"
android:scrollbarSize="1dp"
android:scrollbarThumbHorizontal="#android:color/darker_gray"
android:overScrollMode="never"
android:fadeScrollbars="false"
android:background="#0668b1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:weightSum="7"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/ll_tab_wodetail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#464646"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_wodetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="false"
android:src="#drawable/wo_wodetails" />
<TextView
android:id="#+id/tv_icon_wodetail"
style="?android:attr/tabWidgetStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="W/O Details"
android:textColor="#ffffff"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_details"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:src="#drawable/wo_details"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_wodetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Details"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_spares"
android:layout_weight="1"
android:background="#464646"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_spares"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_spares"
android:gravity="center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_spares"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Spares"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_tools"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_tools"
android:gravity="center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tools"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_tasks"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_tasks"
android:gravity="center_horizontal"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tasks"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_costs"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_costs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/wo_costs"
android:gravity="center_horizontal"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_costs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Costs"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll_tab_trades"
android:background="#464646"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_icon_trades"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:src="#drawable/wo_trades"
android:adjustViewBounds="false" />
<TextView
android:id="#+id/tv_icon_trades"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Trades"
android:textSize="16sp"
android:textColor="#ffffff"
style="?android:attr/tabWidgetStyle"
android:gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:id="#+id/sv_wodetails"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:background="#000000">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tv_wono"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work Oder No"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_wonoval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Equipment"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipmentval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipmenthier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Equipment Hierarchy"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_equipmenthierval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_jobdesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Job Description"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_jobdesc"
android:textColor="#ffffff"
android:background="#drawable/spinner_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/tv_instruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Instruction"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:textColor="#ffffff"
android:id="#+id/et_instruction"
android:background="#drawable/spinner_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="5dp"
android:textSize="18sp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/tv_safetynotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Safety Notes"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_safetynotes"
android:background="#drawable/spinner_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="5dp"
android:textSize="18sp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/tv_wotype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="W/O Type"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/tv_wotypeval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="WO TYPE"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_background"
android:textColor="#ffffff"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dip"
android:orientation="vertical" />
</LinearLayout>
</RelativeLayout>
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>