android -------- ConstraintLayout in RecyclerView incomplete data

Use ConstraintLayout as long as one can be achieved. Reducing the level of nesting layout, drawing performance also improved a lot

ConstraintLayout last few nesting RecyclerView lead to incomplete data

 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="match_parent"
    android:background="@color/colorWhite">


    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?actionBarSize"
        android:focusable="true"
        android:focusableInTouchMode="true"
        app:layout_constraintTop_toTopOf="parent" />


    <VideoView
        android:id="@+id/long_video_view"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintDimensionRatio="16:10"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/iv_back"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="18dp"
        android:src="@drawable/ic_video_content_back"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar" />


    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler_video_comment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/x65"
        android:overScrollMode="never"
        android:scrollbars="none"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/long_video_view"> 
   </androidx.recyclerview.widget.RecyclerView>



   

</androidx.constraintlayout.widget.ConstraintLayout>

 

If you do not set the app: layout_constraintBottom_toBottomOf = "parent", it will lead to the final few item display incomplete.

Set constraints must give recycleview

These two properties coupled with the festival ok

android:layout_height="0dp"

app:layout_constraintBottom_toBottomOf="parent"

 

 

Published 333 original articles · won praise 181 · Views 650,000 +

Guess you like

Origin blog.csdn.net/DickyQie/article/details/104973355