Android关于ScrollView在ConstraintLayout中无效的问题

原因:

ScrollView这个为帧布局,所以起点都是在左上方开始

解决方案:

<ScrollView
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:fillViewport="true"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/cl_tool">
</ScrollView>

主要设置的地方就是宽高,只要把宽高都设置成0dp,就可以解决问题

猜你喜欢

转载自blog.csdn.net/wxx314165038/article/details/132680518