アンドロイド-------- ConstraintLayout RecyclerView不完全なデータで

長いものを達成することができるようConstraintLayout使用。ネスティングレイアウトのレベルを下げると、描画性能も多くのことを改善しました

不完全なデータへの最後のいくつかのネストRecyclerViewリードをConstraintLayout

 

<?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>

 

あなたはアプリを設定しない場合:layout_constraintBottom_toBottomOf =「親」は、それが不完全な最後の数項目の表示につながります。

セットの制約がrecycleviewを与える必要があります

祭りの[OK]をクリックして結合されたこの2つのプロパティ

アンドロイド:layout_height = "0dp"

アプリ:layout_constraintBottom_toBottomOf = "親"

 

 

333元記事公開 ウォンの賞賛181 ビューに65万+を

おすすめ

転載: blog.csdn.net/DickyQie/article/details/104973355