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
2
votes
4 answers

Smooth Scroll Not Working on Initial Scroll for Android RecyclerView

I am working on an Android app that runs on only one devicerunning KitKat. The smooth scrolling feature for a RecylerView I used that was working on other physical tablets and genymotion has unfortunately stopped working on the one device it needs…
2
votes
1 answer

Linear Layout Manager with Recycler view not reversing

I would like to have a recycler view with reversed items and layout, for a chat app. Theoretically this should reverse the layout and stacking order, but the problem is that only one works at a time. If I use reverse layout, it correctly pints to…
brianxautumn
  • 1,162
  • 8
  • 21
2
votes
1 answer

Recyclerview smooth scrolling error

I'm trying to smoothscroll to a position in recyclerview using linear layout manager. void smoothScrollToPosition(int position) However, it doesn't work correctly always. Sometimes, it takes me to the bottom of the list and in the logs, I get the…
2
votes
1 answer

Android custom linear layout manager returns 0 item count after updating support libraries to 23.3.0

After updating the android design and support libraries to 23.3.0, the custom linear layout manager is throwing this exception: java.lang.IndexOutOfBoundsException: Invalid item position 0(0). Item count:0 at…
2
votes
1 answer

How to show item on top regardless of items count with RecyclerView and LinearLayoutManager?

I have a list of items. These items are sorted by date. Items with date before now ("old" items) should not be visible when user opens application but user should be able to see them by scrolling list to top. I find position of first item with date…
mixel
  • 25,177
  • 13
  • 126
  • 165
2
votes
0 answers

Strange LinearLayoutManager.scrollToPositionWithOffset(...) behavior

I have a RecyclerView with an Adapter which holds two different kinds of views. The first view has a slightly bigger width and height than the following views. When starting the activity which contains the RecyclerView, I want to scroll to a certain…
2
votes
5 answers

scrollToPositionWithOffset from LinearLayoutManager on RecyclerView not working

I'm trying to make an horizontal list of sticky images with RecyclerView and I'd like to move them by pixels' offset with scrollToPositionWithOffset. I thought passing 0 as position and the pixels I want to move to right / left as offset. But it…
Rafael Ruiz Muñoz
  • 5,333
  • 6
  • 46
  • 92
2
votes
3 answers

RecyclerView scroll to position and get that view

I want to auto scroll a list item to top (firstVisible item) in my recycler view and get the view at that position, so I can highlight it, from my fragment. So, this is the gist of my fragment code : private void activateNewListItem(int…
1
vote
0 answers

How to change space between rows in FlexboxLayoutManager?

I'm using FlexboxLayoutManager. How to change space between rows, and space between items on the first row? class FlexboxLayoutManagerImpl(context: Context, flexDirection: Int) : FlexboxLayoutManager(context, flexDirection) { override fun…
Slava
  • 443
  • 4
  • 12
1
vote
1 answer

Why does LinearLayoutManager.childAt() returns null?

I have a recylcerview where the method shown below gets called on each selection of an item. The method only runs sucessfully when I do not scroll the recyclerview, so the firstvisible is 0. The moment I scroll down a bit and select something the…
Tupsi
  • 33
  • 6
1
vote
0 answers

Animating RecyclerView from Grid to Linear with MotionLayout

Can I animate transition of RecyclerView items from Grid layout to Linear (Horizontal) layout with use of MotionLayout? I was unable to find any example of that. My goal is to use RecyclerView in this MotionLayout based animated transition of custom…
1
vote
1 answer

LayoutManager.startSmoothScroll scrolls to wrong position

I have a RecyclerView of goods with categories and HorizontalScrollView of good's categories above it. I am trying to implement the following behavior: when you click on category in scroll view, recycler scrolls to first good with this category. To…
QuarK
  • 1,162
  • 2
  • 12
  • 27
1
vote
0 answers

Android : How to add an horizontal Recycler view as list item inside Recycler Grid view list?

I have a Recycler list on which Grid layout Manger set. I want to add an horizontal list (Linear Layout Manager) after 4th position of Grid list as an list item. See iOS sample screen in attachment. Please let me know any solution for this. Thanks.
1
vote
2 answers

Change recyclerView scroll position reference

Is there a way to change the scroll counter reference of recyclerView to start from the center of the screen, and not from the beginning? So that, when I call linearLayoutManager.findFirstVisibleItemPosition() I get the position of the item in the…
1
vote
0 answers

why I get onLayoutChildren called every time when onBindViewHolder is called(when add one view)

I'm using my own custome LinearLayoutManager for the RecyclerView. I need to dynamically add one view if user scroll or move the list by button. When getViewByPosition is called, the onBindViewHolder is called also. And then, onLayoutChildren is…
tainy
  • 951
  • 7
  • 19