使用CoordinatorLayout时,我的ScrollView大小不正确 [英] When using the CoordinatorLayout my ScrollView has an incorrect size
本文介绍了使用CoordinatorLayout时,我的ScrollView大小不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在布局中使用ScrollView,并尝试使用新的 设计支持库中的CoordinatorLayout
.
I'm using a ScrollView in a layout, and am attempting to use the new CoordinatorLayout
from the design support library.
我的布局文件如下:
<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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
...
</LinearLayout>
</ScrollView>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar ... />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
进行测试时,滚动视图仅占据屏幕的一部分.出了什么问题?
When testing this the scrollview only occupies part of the screen. What went wrong?
推荐答案
标准ScrollView仅打算用作父级.您需要将ScrollView更改为 android.support.v4.widget.NestedScrollView
The standard ScrollView is only meant to be used as a parent. You need to change the ScrollView to a android.support.v4.widget.NestedScrollView
.
这篇关于使用CoordinatorLayout时,我的ScrollView大小不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文