android - NestedScrollView 不使用 CoordinatorLayout 滚动
问题描述
尝试在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
。活动也不是全屏的。
解决方案
必须应用此处提到的解决方法:https ://stackoverflow.com/a/36322516 ,因为没有其他方法对我有用。因此,将此答案标记为已接受,直到将工作解决方案发布为答案
推荐阅读
- html - Bootstrap-select 未显示在我的网站上
- python-3.x - Flask,SQLAlchemy,无法将集合与对象或集合进行比较;使用 contains() 来测试成员资格
- android - 如何使用 kotlin 从 firebase 检索 pdf 文件?
- c++ - 结果函数中的递归函数是如何工作的?
- node.js - package.json 中的 "private": true 或 "private": false 是什么意思
- docker - Dockerfile:执行程序运行失败,创建覆盖挂载时出错,符号链接级别太多
- python - 为什么将迭代列表的不同值分配为字典的键只返回一个键(列表的最后一个值)?
- python - 为什么异步循环不能停止?
- symfony5 - 在 Easyadmin 3 UserProfile 视图中调用成员函数 all()
- python - Windows Defender 将我的 Python 脚本分类为特洛伊木马,这是为什么呢?