RecyclerView is cutting off the last item

前端 未结 19 2110
予麋鹿
予麋鹿 2020-12-02 18:47

I have a fragment with a toolbar and a recyclerView inside it.

I am populating the recyclerView with dummy data and then try to show them. For some reason, the last

相关标签:
19条回答
  • 2020-12-02 19:09

    Use RelativeLayout as a parent of RecycerView.It's working for me.

    0 讨论(0)
  • 2020-12-02 19:09

    I was facing the same issue and nether of the answers were helpful.

    I solved this by adding the android:minHeight="?actionBarSize" to CollapsingToolbarLayout.

    Maybe this will help someone.

    0 讨论(0)
  • 2020-12-02 19:12

    Make sure you have layout_height as wrap_content for both RelativeLayout and RecyclerView

    0 讨论(0)
  • 2020-12-02 19:12

    I was having the same problem, After searching lot i found out that My parent view holding the recycleView was not properly constrained as i was using constraintLayout,

    my view hierarchy was like

    constraintLayout->pageViewer with tab->fragment->recyclerView
    

    In my case pageViewer was not constrained properly

    to solve this please check weather the parent is properly aliened or constrained

    0 讨论(0)
  • 2020-12-02 19:15

    I was facing the same issue and what I did is created a LinearLayout and placed my RecyclerView inside it and it solved my issue.I hope this will solve other issue as well.

     <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/companyLabelView">
    
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/companiesRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="@dimen/_8dp"
                    android:layout_marginStart="@dimen/_8sdp"
                    android:layout_marginLeft="@dimen/_8sdp"
                    android:layout_marginTop="@dimen/_8sdp"
                    android:layout_marginEnd="@dimen/_8sdp"
                    android:layout_marginRight="@dimen/_8sdp"
                    android:layout_marginBottom="@dimen/_8sdp"
                    android:overScrollMode="never"
                    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:spanCount="3"
                    tools:itemCount="10"
                    tools:listitem="@layout/company_item_view" />
    
            </LinearLayout>
    
    0 讨论(0)
  • 2020-12-02 19:17

    add android:layout_gravity="top" to recyclerview. if this didn't work add android:layout_gravity="fill_verticle"

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