scroll bar doesn't scroll to the last view

52 views Asked by At

I have a problem with my scroll view

I have tow toolbar one on the top and one on the bottom, and these tool bars should be always on the top of other views

when I scroll down the last view its behind the bottom bar and not shown

this is a pic to show you what I mean :

https://drive.google.com/file/d/0B4lj_Q-eciA7N19meUJuOThWanM/view?usp=sharing

in the red circle there is a view behind that bar I want the view to be shown in the same time the bottom bar still on the top of other views

this is my layout code :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainRoot"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.wujhaat.wujhaatod.MainActivity">

<include
    android:id="@+id/app_bar"
    layout="@layout/app_bar" />

<include
    android:id="@+id/end_bar"
    layout="@layout/end_bar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" />

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/subRoot"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:context="com.wujhaat.wujhaatod.MainActivity">

        <TextView
            android:id="@+id/basic_info"
            android:layout_width="wrap_content"
            android:layout_height="72dp"
            android:layout_marginTop="50dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:gravity="center"
            android:text="@string/title_activity_main"
            android:textColor="@color/primaryColor"
            android:textSize="24sp"
            android:typeface="sans" />

        <TextView
            android:id="@+id/nametv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/basic_info"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/name"
            android:textSize="16sp"
            android:typeface="sans" />

        <EditText
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/nametv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp" />

        <TextView
            android:id="@+id/emailtv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/name"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/email"
            android:textSize="16sp"
            android:typeface="sans" />

        <EditText
            android:id="@+id/email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/emailtv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:hint="@string/email_hint"
            android:inputType="textEmailAddress" />

        <TextView
            android:id="@+id/mobiletv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/email"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/mobile"
            android:textSize="16sp"
            android:typeface="sans" />

        <EditText
            android:id="@+id/mobile"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/mobiletv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:hint="0512345678"
            android:inputType="number"
            android:maxLength="10" />

        <TextView
            android:id="@+id/adultnotv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/mobile"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/adult_no"
            android:textSize="16sp"
            android:typeface="sans" />

        <Spinner
            android:id="@+id/adult_spinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/adultnotv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:entries="@array/traveler_no_spinner" />

        <TextView
            android:id="@+id/childnotv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/adult_spinner"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/child_no"
            android:textSize="16sp"
            android:typeface="sans" />

        <Spinner
            android:id="@+id/child_spinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/childnotv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:entries="@array/traveler_no_spinner" />

        <TextView
            android:id="@+id/infanttv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/child_spinner"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/infant_no"
            android:textSize="16sp"
            android:typeface="sans" />

        <Spinner
            android:id="@+id/infant_spinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/infanttv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:entries="@array/traveler_no_spinner" />

        <TextView
            android:id="@+id/visatv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/infant_spinner"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/visa"
            android:textSize="16sp"
            android:typeface="sans" />

        <Spinner
            android:id="@+id/visa_spinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/visatv"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:entries="@array/yes_no" />

        <TextView
            android:id="@+id/visatv1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/visa_spinner"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/visa"
            android:textSize="16sp"
            android:typeface="sans" />

        <Spinner
            android:id="@+id/visa_spinner1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/visatv1"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:entries="@array/yes_no" />

        <TextView
            android:id="@+id/visatv2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/visa_spinner1"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="72dp"
            android:text="@string/visa"
            android:textSize="16sp"
            android:typeface="sans" />

        <Spinner
            android:id="@+id/visa_spinner2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/visatv2"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:entries="@array/yes_no" />

    </RelativeLayout>
</ScrollView>

</RelativeLayout>

please I need your help???

1

There are 1 answers

0
Joseph Roque On BEST ANSWER

Try adding the following to your ScrollView xml

android:layout_above="@id/end_bar"

This will set your ScrollView to appear relative to your toolbars, fitting it in the space between them, instead of placing them over top of your ScrollView

You may also need to add android:layout_below="@id/app_bar" if it's appearing underneath your top toolbar.