NestedScrollView不与CoordinatorLayout一起滚动

问题描述 投票:0回答:1

尝试使用CoordinatorLayoutNestedScrollView中滚动内容不适用于跟随片段的布局:

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

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:scrollbars="none"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

            <!-- Scrollable content -->

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

如何使NestedScrollView中的内容可滚动? windowSoftInput将以adjustResize为主办活动,主题是Theme.MaterialComponents.Light.NoActionBar。活动也不是全屏。

android android-coordinatorlayout android-design-library android-nestedscrollview androiddesignsupport
1个回答
0
投票

不得不应用这里提到的解决方法:https://stackoverflow.com/a/36322516,因为没有别的东西对我有用。因此,将此答案标记为已接受,直到将工作解决方案作为答案发布

© www.soinside.com 2019 - 2024. All rights reserved.