无法在NestedScrollView中完全滚动 [英] Not be able to fully scroll inside a NestedScrollView
本文介绍了无法在NestedScrollView中完全滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以某种方式,我无法在NestedScrollView中完全滚动.我的NestedScrollView内部是一个TextView,上面有很多文本,下面有一个按钮.向下滚动时,只能看到按钮的顶部(只有几个像素).它滚动得不够远.
Somehow I'm not able to fully scroll inside my NestedScrollView. Inside my NestedScrollView is a TextView with a lot of text and a button below it. When I scroll down I can only see a the top part of the button (only a few pixels). It doesn't scroll far enough.
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:stateListAnimator="@drawable/appbar_always_elevated"
android:layout_height="128dp">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:title="@string/app_name"
app:layout_collapseMode="pin">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
style="@style/Text.Body1.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin"
android:layout_marginTop="@dimen/margin"
android:layout_marginEnd="@dimen/margin"
android:text="@string/large_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appbar"/>
<Button
android:id="@+id/continueButton"
style="@style/Widget.Button.Green"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin"
android:layout_marginStart="@dimen/margin"
android:layout_marginEnd="@dimen/margin"
android:layout_marginBottom="@dimen/margin"
android:text="@string/continue_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
推荐答案
供大家参考,因为我遇到了同样的问题.这是一个已知问题,已在com.google.android.material:material:1.3.0-alpha04
For everyone's reference, since I just had the same problem. This is a known issue and has been fixed in com.google.android.material:material:1.3.0-alpha04
这篇关于无法在NestedScrollView中完全滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文