美文网首页
解决NestedScrollView 布局不能撑满屏幕 的问题

解决NestedScrollView 布局不能撑满屏幕 的问题

作者: 雨田Android开发 | 来源:发表于2023-08-01 13:45 被阅读0次

最近使用 NestedScrollView 嵌套使其布局超出屏幕时滑动; 想让最后一个子布局位于屏幕最底方;

各种方法都不行,后来发现NestedScrollView 的 子布局不能撑满整个屏幕,而是包裹内容,按照wrap_content来计算,哪怕写的 match_parent 也没用;

解决办法:

添加属性:

android:fillViewport="true"  
<android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:overScrollMode="never">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            .....

        </LinearLayout>
</android.support.v4.widget.NestedScrollView>

相关文章

网友评论

      本文标题:解决NestedScrollView 布局不能撑满屏幕 的问题

      本文链接:https://www.haomeiwen.com/subject/vuoypdtx.html