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:

160 questions
39
votes
6 answers

RecyclerView smoothScroll to position in the center. android

I am using a horizontal layout manager for my RecyclerView. I need to make RecyclerView in the next way: when click on some item - make smoothScrool to that position and put that item in the center of RecyclerView (if it possible, for example, 10…
Stan Malcolm
  • 2,420
  • 4
  • 28
  • 46
39
votes
17 answers

RecyclerView - Scroll To Position Not Working Every Time

I have implemented a horizontal scrollable RecyclerView. My RecyclerView uses a LinearLayoutManager, and the problem I am facing is that when I try to use scrollToPosition(position) or smoothScrollToPosition(position) or from LinearLayoutManager's…
Abbas
  • 2,875
  • 4
  • 32
  • 57
31
votes
5 answers

How to scroll to a particular position in recyclerview inside scrollview?

I have searched a lot regarding my query and none of them was useful. I have a recyclerview and some static data inside a scroll view which is inside a root parentlayout as show below. I have set - scrollview.scrollto(0,0); because everytime i…
24
votes
7 answers

RecyclerView scroll to position when a new item is added

I want my RecyclerView to scroll to the bottom when a new item is added to the list. Below is my code: RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layoutManager); adapter = new…
Arshad Yusuf
  • 369
  • 1
  • 2
  • 9
20
votes
2 answers

RecyclerView scrolling on insert

I am trying to use RecyclerView to create a chat application. I am using a LinearLayoutManager with setReverseLayout(true). When I am scrolled all the way to the bottom (which is the dataset start = newest message) and a new message is inserted…
ehehhh
  • 1,068
  • 3
  • 16
  • 27
15
votes
10 answers

RecyclerView scrolls to top on notifyDataSetChanged in chat screen

I am trying to create messaging kind of screen using recyclerView which will start from bottom and will loadMore data when user reached top end of chat. But I am facing this weird issue. My recyclerView scrolls to top on calling…
14
votes
3 answers

LinearLayoutManager cannot resolve getOrientation()

I have a RecyclerView implemented in a fragment and I'm trying to add dividers to the code. I have the RecylcerView working as intended, but the LinearLayoutManager cannot resolve the getOrientation() function. private RecyclerView…
12
votes
4 answers

RecyclerView items lose focus

In my fire tv app I'm using a recyclerview with horizontal layout. Scrolling with dpad works and also items are gaining focus. But when I hold the button it scrolls very fast because many keydown events are triggered, and items are losing their…
sNore
  • 360
  • 5
  • 16
11
votes
4 answers

Horizontally center first item of RecyclerView

I want to use a RecyclerView to emulate the behavior of a MultiViewPager, in particular I'd like to have the selected item at the center of the screen, including the first and the last element. As you can see in this image, the first item is…
Vektor88
  • 4,429
  • 9
  • 52
  • 102
11
votes
2 answers

How to access LayoutManager from RecyclerView.Adapter to get scrollToPosition?

I customized RecyclerView by adding separate layouts for header and footer. I created constants to determine the property of header, footer and list item in the adapter class. I also created a ViewHolder pattern and assign the layouts to be shown…
11
votes
1 answer

Finding top offset of first visible item in a RecyclerView

I have a RecyclerView + LinearLayoutManger which is using an adapter that holds chat messages. I limit the number of chat messages to the most 100 recent. This issue is that when I remove the older chats, the scroll position of the chats in the…
tylerjroach
  • 2,639
  • 4
  • 16
  • 24
10
votes
0 answers

Weird behavior (bug?) with RecyclerView And LinearLayoutManager with reverseLayout == true

When using RecyclerView with LinearLayoutManager and "reverseLayout" flag set to true, when notifying any item via notifyItemChanged it also calls onBindViewHolder for the first non-visible item. And it doesn't call onViewRecycled for that item…
Dmitry
  • 1,512
  • 1
  • 7
  • 17
10
votes
2 answers
8
votes
1 answer

Start my RecyclerView Horizontal Carousel from the center item

I'm creating a carousel Horizontal RecyclerView with Zoom on focused item that is starting from the first item of the RecyclerView. Code for custom CenterZoomLayoutManager: public class CenterZoomLayoutManager extends LinearLayoutManager { private…
8
votes
1 answer

layoutmanager.FindFirstCompletelyVisibleItemPosition always returns -1

I have a recyclerview in my android project which displays media contents within each view. What I'm trying to achieve is that I'm able to play/pause media as I scroll up and down. I need to get the adapter position of the completely visible view.…
Ahmed Mujtaba
  • 1,842
  • 2
  • 24
  • 65
1
2 3
10 11