美文网首页
android ConstraintLayout 嵌套Recyc

android ConstraintLayout 嵌套Recyc

作者: 因为我的心 | 来源:发表于2020-12-18 10:02 被阅读0次

一、前言:

解决方法:

如果不设置 app:layout_constraintBottom_toBottomOf="parent",就会导致最后的几条item显示不全。
一定要给recycleview设置上下约束

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="423dp"
    android:background="@color/white">
    <ImageView
        android:id="@+id/close"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/dp16"
        android:layout_marginRight="@dimen/dp14"
        android:src="@drawable/icon_guanbi"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
    <android.support.v7.widget.RecyclerView
        android:id="@+id/musicRecycleView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_marginTop="@dimen/dp15"
        app:layout_constraintTop_toBottomOf="@+id/close"/>
</android.support.constraint.ConstraintLayout>

相关文章

网友评论

      本文标题:android ConstraintLayout 嵌套Recyc

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