原因: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