简体   繁体   中英

Cannot scroll Android screen until the bottom of layout?

I'm implementing a screen for proiding user feedback. Basically, a bunch of TextViews, RatingBars, EditTexts, and 1 big Button on the bottom. Here are the relevant layouts:

activity_feedback.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="feedback.app.devbyzero.net.trainingfeedback.FeedbackActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/toolbar2"
            android:layout_width="match_parent"
            android:layout_height="90dp"
            android:background="@drawable/ab_img"
            app:contentInsetEnd="0dp"
            app:contentInsetLeft="0dp"
            app:contentInsetRight="0dp"
            app:contentInsetStart="0dp"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        <TextView
            android:text="TRAINING FEEDBACK"
            android:textSize="20dp"
            android:background="@color/login_grey"
            android:textColor="@color/login_green"
            android:layout_height="wrap_content"
            android:paddingLeft="8dp"
            android:textStyle="bold"
            android:layout_width="match_parent" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_feedback" />
</android.support.design.widget.CoordinatorLayout>

content_feedback.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="feedback.app.devbyzero.net.trainingfeedback.FeedbackActivity"
    tools:showIn="@layout/activity_feedback">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:text="I. ISI PELATIHAN"/>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv1"
                    android:layout_width="match_parent"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb1"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv2"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:theme="@style/RatingBar"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv3"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb3"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv4"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb4"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv5"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb5"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv6"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb6"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv7"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb7"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <Space
                    android:layout_width="1dp"
                    android:layout_height="10dp"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="Komentar/saran mengenai isi/materi"
                    />

                <EditText
                    android:id="@+id/et0"
                    android:layout_width="match_parent"
                    android:background="@layout/custom_edit_border"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="80dp"
                    android:inputType="text|textMultiLine"
                    android:textSize="15sp"
                    android:gravity="top"/>


            </LinearLayout>

        </LinearLayout>

        <Space
            android:layout_width="match_parent"
            android:layout_height="8dp"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:text="II. FASILITATOR"/>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv9"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb9"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv10"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb10"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv11"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb11"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv12"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb12"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv13"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb13"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <Space
                    android:layout_width="1dp"
                    android:layout_height="10dp"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="Komentar/saran mengenai fasilitator/trainer/pembicara"
                    />

                <EditText
                    android:id="@+id/et1"
                    android:layout_width="match_parent"
                    android:layout_height="80dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:inputType="text|textMultiLine"
                    android:textSize="15sp"
                    android:background="@layout/custom_edit_border"
                    android:gravity="top"/>


            </LinearLayout>

        </LinearLayout>

        <Space
            android:layout_width="match_parent"
            android:layout_height="8dp"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:text="III. SARANA - untuk pelatihan yang dilakukan pihak ketiga di luar kantor YKAN"/>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv15"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb15"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv16"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb16"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv17"
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_height="wrap_content"
                    />

                <RatingBar
                    android:id="@+id/rb17"
                    android:theme="@style/RatingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="false"
                    android:numStars="5"
                    android:stepSize="1"
                    android:layout_gravity="center"/>
            </LinearLayout>

            <Space
                android:layout_width="match_parent"
                android:layout_height="2dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <Space
                    android:layout_width="1dp"
                    android:layout_height="10dp"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textStyle="bold"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:text="IV. Saran-saran perbaikan lainnya"
                    />

                <EditText
                    android:id="@+id/et2"
                    android:layout_width="match_parent"
                    android:layout_height="80dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:inputType="text|textMultiLine"
                    android:textSize="15sp"
                    android:background="@layout/custom_edit_border"
                    android:gravity="top"/>

                <android.support.v7.widget.AppCompatButton
                    android:id="@+id/btn_submit"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="24dp"
                    android:layout_marginBottom="24dp"
                    android:padding="12dp"
                    android:layout_gravity="center_horizontal"
                    android:background="@color/login_green"
                    android:textColor="@color/white"
                    android:text="Submit"/>

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>



</ScrollView>

Well, it's stop at the last EditText (et2). The submit button is not visible. Previously the screen was fine... until I added some modifications on the android.support.v7.widget.Toolbar part so it displays a background image. How to fix this?

Replace ScrollView with NestedScrollView

  <android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"> /...your code.../</android.support.v4.widget.NestedScrollView>

ScrollView is not suitable for Co-ordinator layout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM