We can see here last item is partially visible. How can i fix this?
layout.xml
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" />
For others.Disabling nested scrolling in recyclerview also causes this problem in CoordinatorLayout with scrollable toolbar or tablayout. Because when you scroll recyclerview, toolbar or tablayout doesn't scroll.
Easiest but not the best solution. Still works;
Return +1 in the getItemCount()
method of your RecyclerView.Adapter
implementation and wrap your code in onBindViewHolder
method override with a try-catch
block.
Use RelativeLayout instead of ConstraintLayout.It's working for me.
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">
@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"/>