首页 > 其他 > 详细

ScrollView嵌套ConstraintLayout导致最后一项显示不全

时间:2020-04-05 00:57:53      阅读:830      评论:0      收藏:0      [点我收藏+]

原因:scrollView不受ConstraintLayout的约束布局影响

 

解决方法:

保持scrollview的宽高为0dp,设置其相对ConstraintLayout相对约束

<androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ScrollView
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"

            >
            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </androidx.constraintlayout.widget.ConstraintLayout>
        </ScrollView>
    </androidx.constraintlayout.widget.ConstraintLayout>

 

ScrollView嵌套ConstraintLayout导致最后一项显示不全

原文:https://www.cnblogs.com/monkey-home/p/12635086.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!