Scroll View - невозможно прокрутить вниз - PullRequest
0 голосов
/ 11 мая 2018

Я проектирую один файл макета, который содержит информацию об образовании, ранее информация не помещалась на экране, поэтому я добавил вид прокрутки.Я могу прокрутить экран вниз, но не полностью.Я попытался положить scrollView сверху всех относительных макетов, но он не прокручивался полностью, я попытался ввести описание ссылки здесь , но не смог решить мою проблему.

нужна помощь?

frag_education.xml

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

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/slide_title"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="@dimen/slide_title"
        android:background="@color/Blue"
        android:paddingLeft="@dimen/slide_title">

        <RelativeLayout
            android:id="@+id/be_details"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp">

            <TextView
                android:id="@+id/be_year"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2016"
                android:textSize="@dimen/slide_title"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/college"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/slide_title"
                android:layout_toRightOf="@+id/be_year"
                android:text="SKIT,Banglore"
                android:textSize="20dp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/course"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/college"
                android:layout_marginLeft="@dimen/slide_title"
                android:layout_toRightOf="@+id/be_year"
                android:text="@string/course_detail"
                android:textColor="@color/lighter"
                android:textSize="20sp" />

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/th12_detail"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/be_details"
            android:layout_marginTop="@dimen/slide_title">

            <TextView
                android:id="@+id/th12_year"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2012"
                android:textSize="@dimen/slide_title"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/th12_college"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/slide_title"
                android:layout_toRightOf="@+id/th12_year"
                android:text="SLIC,Rampur"
                android:textSize="20dp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/th12_course"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/th12_college"
                android:layout_marginLeft="@dimen/slide_title"
                android:layout_toRightOf="@id/th12_year"
                android:text="@string/th12_details"
                android:textColor="@color/lighter"
                android:textSize="20sp" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/school_detail"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/th12_detail"
            android:layout_marginTop="@dimen/slide_title">

            <TextView
                android:id="@+id/scl_year"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2010"
                android:textSize="@dimen/slide_title"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/scl_school"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/slide_title"
                android:layout_toRightOf="@+id/scl_year"
                android:text="SRHS,Tanda"
                android:textSize="20dp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/scl_detail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/scl_school"
                android:layout_marginLeft="@dimen/slide_title"
                android:layout_toRightOf="@id/scl_year"
                android:text="@string/school_details"
                android:textColor="@color/lighter"
                android:textSize="20sp" />


        </RelativeLayout>
    </RelativeLayout>


</ScrollView>

где я делаю не так?

Ответы [ 2 ]

0 голосов
/ 11 мая 2018

Единственное, что нужно сделать для решения, это просто добавить вложенное представление прокрутки в представление прокрутки, вот рабочий код:

        <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
             <android.support.v4.widget.NestedScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="10dp">
                <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/slide_title"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="@dimen/slide_title"
                android:background="@color/Blue"
                android:paddingLeft="@dimen/slide_title">
                <RelativeLayout
                    android:id="@+id/be_details"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp">
                    <TextView
                        android:id="@+id/be_year"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="2016"
                        android:textSize="@dimen/slide_title"
                        android:textStyle="bold" />
                    <TextView
                        android:id="@+id/college"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/slide_title"
                        android:layout_toRightOf="@+id/be_year"
                        android:text="SKIT,Banglore"
                        android:textSize="20dp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/course"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/college"
                        android:layout_marginLeft="@dimen/slide_title"
                        android:layout_toRightOf="@+id/be_year"
                        android:text="@string/course_detail"
                        android:textColor="@color/lighter"
                        android:textSize="20sp" />

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/th12_detail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/be_details"
                    android:layout_marginTop="@dimen/slide_title">
                    <TextView
                        android:id="@+id/th12_year"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="2012"
                        android:textSize="@dimen/slide_title"
                        android:textStyle="bold" />
                    <TextView
                        android:id="@+id/th12_college"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/slide_title"
                        android:layout_toRightOf="@+id/th12_year"
                        android:text="SLIC,Rampur"
                        android:textSize="20dp"
                        android:textStyle="bold" />
                    <TextView
                        android:id="@+id/th12_course"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/th12_college"
                        android:layout_marginLeft="@dimen/slide_title"
                        android:layout_toRightOf="@id/th12_year"
                        android:text="@string/th12_details"
                        android:textColor="@color/lighter"
                        android:textSize="20sp" />
                </RelativeLayout>
                <RelativeLayout
                    android:id="@+id/school_detail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/th12_detail"
                    android:layout_marginTop="@dimen/slide_title">
                    <TextView
                        android:id="@+id/scl_year"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="2010"
                        android:textSize="@dimen/slide_title"
                        android:textStyle="bold" />
                    <TextView
                        android:id="@+id/scl_school"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/slide_title"
                        android:layout_toRightOf="@+id/scl_year"
                        android:text="SRHS,Tanda"
                        android:textSize="20dp"
                        android:textStyle="bold" />
                    <TextView
                        android:id="@+id/scl_detail"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/scl_school"
                        android:layout_marginLeft="@dimen/slide_title"
                        android:layout_toRightOf="@id/scl_year"
                        android:text="@string/school_details"
                        android:textColor="@color/lighter"
                        android:textSize="20sp" />
                  </RelativeLayout>
              </RelativeLayout>
            </android.support.v4.widget.NestedScrollView>
        </ScrollView>
0 голосов
/ 11 мая 2018

Удалите android:layout_marginBottom="@dimen/slide_title" и android:layout_marginTop="@dimen/slide_title" из первого RelativeLayout после ScrollView, и он будет работать

...