ScrollView не прокручивается вниз - PullRequest
0 голосов
/ 21 мая 2018

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/page_background"
android:clickable="true"
android:orientation="vertical"
>

 <RelativeLayout
   android:layout_width="match_parent"
   android:layout_height="?android:attr/actionBarSize"
   android:gravity="center_vertical"
   android:layout_weight="0"
   android:clickable="true"
   android:background="@color/button_colour">
 </RelativeLayout>

 <ScrollView
  android:layout_width="match_parent"
  android:layout_height="0dp"
  android:layout_weight="1"
  android:fillViewport="true"
 >
 <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:weightSum="14"
   android:padding="2dp"
   android:clickable="true"
   android:orientation="vertical">
 </LinearLayout>

 </ScrollView>

 </LinearLayout>

1 Ответ

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

В этом случае android:layout_weight не используется.А также вам не нужно использовать android:layout_weight внутри ScrollView.Если вы используете Views, то обернетесь внутри ViewGroup и не будет прокручиваться.И fill_parent является ограниченным. Используйте match_parent.

. Используйте макет ниже:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="?android:attr/actionBarSize"
    android:background="@color/colorPrimary"
    android:clickable="true"
    android:gravity="center_vertical">


</RelativeLayout>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorAccent"
        android:orientation="vertical"
        android:padding="2dp"
        >
        <!--Other views goes here without weight-->

    </LinearLayout>
</ScrollView>
</LinearLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...