尝试使用CoordinatorLayout
滚动NestedScrollView
中的内容不适用于片段的以下布局:
<?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
。而且该活动不是全屏的。
答案 0 :(得分:0)
必须应用此处提到的解决方法:https://stackoverflow.com/a/36322516,因为没有其他方法可以为我工作。因此,将这个答案标记为接受,直到发布有效的解决方案作为答案为止