我在布局中使用ScrollView,并试图从devise支持库中使用新的CoordinatorLayout
。
我的布局文件如下所示:
<android.support.design.widget.CoordinatorLayout xmlns:android="https://schemas.android.com/apk/res/android" xmlns:app="https://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>
当testing这个滚动视图只占据屏幕的一部分。 什么地方出了错?
标准的ScrollView只能用作父级。 您需要将ScrollView更改为android.support.v4.widget.NestedScrollView
。
一个例子可以在AppBarLayout
的参考文档中AppBarLayout
。
以上就是android开发分享当使用CoordinatorLayout时,我的ScrollView的大小不正确相关内容,想了解更多android开发(异常处理)及android游戏开发关注计算机技术网(www.ctvol.com)!)。
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/addevelopment/512994.html