Last Item in recyclerview is cut off
Your RecyclerView
is not properly constrained. You can either use 0dp
(MATCH_CONSTRAINT
) for the height and use all available space:
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
or if you want to keep it as wrap_content
you will need to set app:layout_constrainedHeight="true"
attribute to enforce the constraints:
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:visibility="visible"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
RecyclerView Last Element Not Showing or getting cut off
this obviously is because of:
<View
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="@color/colorPrimary"
android:id="@+id/view"
tools:ignore="MissingConstraints"
app:layout_constraintBottom_toBottomOf="parent"/>
have you ever had a closer look at the first one CardView
??
android:fillViewport="true"
and tools:ignore="MissingConstraints"
look suspicious;
replace these ConstraintLayout
with LinearLayoutCompat
, because these are linear layouts.
that NestedScrollView
just would need weight 1.00
and height 0dp
, to fill the space.
RecyclerView cutting off last item
@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"/>
Last item in RecyclerView not shown
add:app:layout_constraintBottom_toBottomOf="parent"
and change height of recyclerview to 0dp
RecyclerView last row cut off on the bottom
To fix the issue you can 1) set root view height to match_parent
and 2) replace fixed size of recyclerview to 0dp
to fit the screen.
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" <!-- 1 -->
tools:context=".ShowActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView2"
android:paddingTop="?attr/actionBarSize"
android:layout_width="409dp"
android:layout_height="0dp" <!-- 2 -->
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Android: last card of RecyclerView cut off. Can't scroll any further. Why would this happen?
Solved by poss: https://stackoverflow.com/users/4048794/poss
choosing wrap_content as the attribute for layout_width and layout_height causes the cut-off on RecyclerViews
Related Topics
Android: Mkdirs()/Mkdir() on External Storage Returns False
How to Get Minutes Difference Between Two Time in Android
How to Display an Image in Full Screen on Click in the Imageview
Where Is Android_Sdk_Root and How to Set It.
Remove Span Tag With Text from String
Touchableopacity Not Working Inside an Absolute Positioned View
Force Override Camera Image on Android
Android Check Null or Empty String in Android
App Crashes (Sometimes) With Fatal Signal 11 (Sigsegv), Code 1
How to Refresh a Previous Activity After the Back Button Is Pressed
Reload Recyclerview from Within the Adapter of the Recycler View
How to Check If the Current Activity Has a Dialog in Front
Waiting Till the Async Task Finish Its Work
How to Completely Rename an Android Application
How to Make a Background 20% Transparent on Android
Eclipse Compiles Successfully But Still Gives Semantic Errors
React Native: Java_Home Is Not Set and No 'Java' Command Could Be Found in Your Path