Содержание CoordinatorLayout не прокручивается с фиксированным нижним компонентом - PullRequest
0 голосов
/ 25 мая 2019

Я пытаюсь создать CoordinatorLayout с фиксированным нижним компонентом (LinearLayout с текстом и кнопкой), который имеет некоторый прокручиваемый контент в середине (ниже панели инструментов и над нижним компонентом), однако контент не прокручивается даже хотя я использовал NestedScrollView для этого.

Это мой макет XML,

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinator"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        app:navigationIcon="@drawable/ic_back_blue" />

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingStart="72dp"
        android:paddingEnd="72dp"
        android:scrollbars="none"
        android:layout_gravity="center_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="16dp"
            android:layout_marginLeft="16dp"
            android:orientation="vertical">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="120dp"
                android:layout_marginTop="16dp"
                android:layout_gravity="center">

                <ImageView
                    android:id="@+id/feature_image"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:src="@drawable/feature_image"
                    android:importantForAccessibility="no"
                    tools:visibility="visible" />

                <com.airbnb.lottie.LottieAnimationView
                    android:id="@+id/feature_animation"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone"/>

            </FrameLayout>

            <TextView
                android:id="@+id/screen_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:textSize="24sp"
                android:textColor="?textColorPrimary"
                android:gravity="center"
                android:text="Title for the page, highlighting the main idea"/>

            <TextView
                android:id="@+id/screen_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:layout_marginBottom="16dp"
                android:textSize="18sp"
                android:gravity="center"
                android:text="Message description tezt, explaining the idea in a little more detail to give the users more context" />

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_alignParentBottom="true"
        android:paddingStart="72dp"
        android:paddingEnd="72dp"
        android:background="?contentBackgroundColor">

        <TextView
            android:id="@+id/screen_additional_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:paddingStart="16dp"
            android:paddingEnd="16dp"
            android:gravity="center"
            android:text="Additional message text, with any other useful info, disclaimers etc.." />

        <Button
            android:id="@+id/screen_primary_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_gravity="bottom"
            android:text="Call to Action" />

    </LinearLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

И вот как это выглядит (содержимое в середине не прокручивается), enter image description here

Может кто-нибудь сообщить мне, что я здесь делаю не так?

Спасибо!

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