Questions tagged [linearlayoutmanager]

A RecyclerView.LayoutManager implementation which provides similar functionality to ListView. It was introduced with the Android L Developer Preview along with RecyclerView, but is also available as part of the Support Library.

LinearLayoutManager is an implementation of RecyclerView.LayoutManager which provides similar functionality to ListView, i.e., it arranges items in a linear arrangement, either horizontal or vertical, much like LinearLayout ViewGroup. It was introduced with the Android L Developer Preview along with RecyclerView, but is also available as part of the Support Library.

Official Documentation

Other RecyclerView.LayoutManager implementations:

170 questions
4
votes
2 answers

Added View has RecyclerView as parent but view is not a real child

I have an issue appears sometimes when content of RecyclerView is changes. I have search view that filters data of RecyclerView. After filtering I call notifyDataSetChanged(); I use this as adapter. I was thinking that issue related with adding…
4
votes
0 answers

RecyclerView redraw content on onLayoutChildren()

I'm using a custom LayoutManager for RecyclerView (FlowLayoutManager) that is working fine and this is the function used for laying out the children: @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State…
Gilad Eshkoli
  • 1,253
  • 11
  • 27
4
votes
0 answers

Custom Linear Layout Manager add an empty card to recyclerView

I am using recycler view to display list of cards in my android app. Earlier i was using LinearLayoutManager to set layout manager for recycler view. But using this wrapcontent value for height tag of recycler view was not working and it covered…
Aditya Verma
  • 91
  • 1
  • 10
3
votes
1 answer

Prefetching view for child recycler view is not working

I have vertical RecyclerView with child(nested) horizontal RecyclerView. For second recycler I use layout manager: LinearLayoutManager(itemView.context, LinearLayoutManager.HORIZONTAL, false).apply { isItemPrefetchEnabled = true …
andreich
  • 1,120
  • 1
  • 11
  • 28
3
votes
1 answer

How can I animate Recycler-View while changing the layout-manager

In my app design I need to change layout manager of recycler-view from linear-horizontal to grid layout manager I need to make this transition smooth. Can anyone suggest me how can I make it possible.
3
votes
2 answers

Check whether a RecyclerView needs to scroll

I have a callback that is fired after a programmatic scroll to a certain item of a RecyclerView via LinearLayoutManager.smoothScrollToPosition(). The user taps on an item and the right item is scrolled to the top of the RecyclerView. I subclassed…
Micky
  • 5,578
  • 7
  • 31
  • 55
3
votes
2 answers

One LinearLayoutManager is only for one RecyclerView?

I am building an app having three RecyclerView in one fragment to show horizontal list of items. i created a LinearLayoutManager object and set it to all three RecyclerView . but it crashes app, saying one LinearLayoutManager can attached to only…
Adnan Ali
  • 792
  • 1
  • 8
  • 21
3
votes
2 answers

Change LayoutManager depending on device format

I have a RecyclerView with a list of Cards. I want to know whether it's possible to change the RecyclerView's LayoutManager to Linear, when using a phone, and StaggeredGrid, when using a tablet, programmatically. My initial idea was to have the…
2
votes
0 answers

RecyclerView not scrolling top top when new item inserted

I have a RecyclerView which allows swipe-to-delete functionality. After deliting, a Snackbar shows to confirm deletion with an action that allows users to "undo" the delete. Everything works fine until I delete the item at position 0 then hit undo.…
Muzzle
  • 233
  • 2
  • 11
2
votes
0 answers

Item insertion animation is all wrong in reversed stackFromEnd RecyclerView

My code looks like this, I am setting my layoutManager in onAttachedToRecyclerView of my Adapter. class ChatsAdapter(messages:List): RecyclerView.Adapter{ init { setHasStableIds(true) } override fun…
Rishabh876
  • 3,010
  • 2
  • 20
  • 37
2
votes
2 answers

how to fix RecyclerView.setLayoutManager NullPointerException in fragment

Error: process: tifawt.com.yourschool, PID: 8372 java.lang.RuntimeException: Unable to start activity ComponentInfo{tifawt.com.yourschool/tifawt.com.yourschool.activities.main_activity}: java.lang.NullPointerException: Attempt to…
2
votes
0 answers

infinity recyclerview for fixed count of items

I need something like this: After last element of my recyclerview should be first element, and vice versa. For example: View2, View3, View4, View1, View2, View3, View4, View1, View2... and so on. EDIT ok, this is part of adapter: @Override public…
2
votes
4 answers

LinearLayoutManager.findViewByPosition() is returning null

My Activity is showing a RecyclerView with a LinearLayoutManager. I want to get the first item (View) in the list. According this post's accepted answer , I can do it calling LinearLayoutManager.findViewByPosition() method, but I'm getting null…
Héctor
  • 24,444
  • 35
  • 132
  • 243
2
votes
3 answers

Snap Recyclerview item to Center when loaded

I am using an infinite scroll for recyclerview with X items which repeats. Also i want am using PagerSnapHelper() to snap the scroll like viewpager. So initially when the list is loaded the display is like - As soon as i start scrolling on either…
2
votes
1 answer

Recycler View linear layout manager returning null

I have a recycler view which contains multiple items and each item in the recycler view contains a horizontal recycler view.The problem I am encountering is that the layout manager is null. java.lang.NullPointerException: Attempt to invoke virtual…
Jude Fernandes
  • 7,437
  • 11
  • 53
  • 90
1 2
3
11 12