【发布时间】:2019-09-17 23:01:18
【问题描述】:
尝试使用NestedScrollView 在CoordinatorLayout 内滚动内容不适用于以下片段布局:
<?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。活动也不是全屏的。
【问题讨论】:
-
您是否要制作折叠布局?
-
@Mr.AF No. 我用
CoordinatorLayout在状态栏后面画图 -
嵌套滚动视图中是否有可滚动视图或者它是空的?
-
我在嵌套滚动视图中有一个表单,所以嵌套滚动视图中有很多视图应该可以滚动
标签: android android-coordinatorlayout android-design-library android-nestedscrollview androiddesignsupport