RecyclerView cutting off last item

前端 未结 7 891
孤街浪徒
孤街浪徒 2021-01-02 01:34

\"enter We can see here last item is partially visible. How can i fix this? layout.xml

相关标签:
7条回答
  • 2021-01-02 02:16

    I had this problem with a RecyclerView inside a ConstraintLayout, and i changed my recyclerview constriants to "0dp" (match_constraint) and had no further trouble.

    have a look

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >
    
        <!-- Title -->
        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/view_with_press_height"
            android:text="@string/taxes_fees_charges"
            android:gravity="center_vertical"
            android:layout_marginStart="@dimen/general_side_margin"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            />
    
       <!-- Details Recyclerview-->
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/title"
            app:layout_constraintBottom_toBottomOf="parent"
            android:layout_marginBottom="@dimen/general_bottom_margin"
            app:layout_constraintVertical_bias="0.0"
            tools:itemCount="28"
            tools:listitem="@layout/tax_details_row" />
    
    </android.support.constraint.ConstraintLayout>
    

    if you want to use the tools:itemCount="28" you will have to import xmlns:tools="http://schemas.android.com/tools" in your XMLfile.

    0 讨论(0)
提交回复
热议问题