Recyclerview Cutting Off Last Item
Solution 1:
I'm also having the same problem. In my opinion this happened because you set the AppBarLayout XML attribute android:fitsSystemWindows="true". To solve this i give the RecyclerView margin bottom equal to action bar size
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/recyclerView"
android:layout_marginBottom="?attr/actionBarSize">
Solution 2:
@Lester was right problem was RecyclerView's wrap_content height. But changing match_parent was not working because. This layout was added to a fragment and that fragment was declared wrap_content. So I have changed fragment's height and recyclerview's height to match_parent and now problem solved.
<fragment
android:id="@+id/fragment"
android:name="com.example.fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Solution 3:
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.ConstraintLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"
><!-- Title --><TextViewandroid: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.RecyclerViewandroid: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 XML
file.
Solution 4:
I tried all the available option from most of possible site but I didn't get the solution. Then, I think can I use bottom padding? And Yes, It's work for me.
I am sharing the code to you. Nothing more attribute required other than height, width & padding.
android:paddingBottom="?attr/actionBarSize"
<android.support.v7.widget.RecyclerView
android:id="@+id/your id name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="?attr/actionBarSize"
app:layout_constraintTop_toBottomOf="@+id/your field" />
Solution 5:
Use RelativeLayout instead of ConstraintLayout.It's working for me.
Post a Comment for "Recyclerview Cutting Off Last Item"