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
1
vote
1 answer

Android: restore RecyclerView item positions after app re-opens

I have a RecyclerView list of CardView items. I save CardView data to a SQLite database. The user can drag CardViews up and down in the list to change the order of the items. When the user exits the app, I'd like to save the current order of the…
AJW
  • 1,578
  • 3
  • 36
  • 77
1
vote
1 answer

recyclerview items outside view bound invisible

I have the following situation: I have a vertical RecyclerView with padding and the parent layouts clipChildren and clipToPadding set to false like so:
Moritz
  • 21
  • 1
  • 3
1
vote
0 answers

What is the difference if I set a reversed list to recyclerView Adapter rather than calling setReverseLayout(true) and setStackFromEnd(true)?

I want to reverse the RecyclerView. One way to do this is: LinearLayoutManager mLayoutManager = new LinearLayoutManager(this); mLayoutManager.setReverseLayout(true); mLayoutManager.setStackFromEnd(true); // Set the layout manager to your…
1
vote
0 answers

How to make an horizontal RecyclerView match phone borders and go back to line

I am making a list of tags, and I put them in a RecyclerView. Here is my code : var tagsRv : RecyclerView? = null tagsRv = binding.tagsRv tagsRv?.adapter = tagsAdapter val layoutManager : LinearLayoutManager = LinearLayoutManager(this,…
Mathieu
  • 1,435
  • 3
  • 16
  • 35
1
vote
1 answer

Scroll in recyclerview scrolls to bottom of view instead of top

I'm using a RecyclerView that displays pages from a book. I have an EditText box that takes you to a page in the book. The only problem is that when it scrolls to the page of the book sometimes it will scroll to the top of the page and sometimes to…
1
vote
1 answer

How to call jumpTo(targetPosition) using RecyclerView

void jumpTo (int targetPosition) Instead of specifying pixels to scroll, use the target position to jump using scrollToPosition(int). You may prefer using this method if scroll target is really far away and you prefer to jump to a location and…
Seghers
  • 121
  • 6
1
vote
1 answer

GridLayoutManager scrollToPosition doesn't scroll

I am passing the position of the RecyclerView from first FirstFragment to SecondFragment and it works. After scrolling in that one, I get the position again and I am passing it to the FirstFragment. But, when FirstFragment gets the position, the…
1
vote
3 answers

Change Background of RecyclerView Item at specific position

I have a RecyclerView and clicking its item takes to a new Activity. There is a ViewPager with multiple items. On pressing back, I am saving the current item position. What I want to do is when a user presses back while standing on any item in a…
1
vote
2 answers

Dynamic height Glide ImageView inside RecyclerView Blinking on calling notifydatasetchanged?

Am creating a RecyclerView to show some images and text, then user can bookmark rows of RecyclerView. Images of the RecyclerView are match parent on width and height will be wrap_content. On clicking on bookmark, adapter calls notifydatasetchanged…
1
vote
0 answers

Custom layout manager for an image gallery?

I'm need your help with LayoutManager. Here is a picture of what i need: I tried StagerredGridLayoutManager but rows have constant width. I don't know if i need to write a custom layout manager in this case? If so, I have no idea how to resize…
1
vote
0 answers

IndexOutOfBoundException with RecyclerView

I am experiencing a problem with my application. I am getting a java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder and not only on Samsung device but also on LG because I have read somewhere…
1
vote
0 answers

How to scrollToPosition RecyclerView with HORIZONTAL LinearLayoutManager

This code works as intended: LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.scrollToPosition(2); The…
1
vote
1 answer

Android LinearLayoutManager#getChildAt(int) retuns null

I have this code public class CustomLinearLayoutManager extends LinearLayoutManager { @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { super.onLayoutChildren(recycler, state); …
s.maks
  • 2,583
  • 1
  • 23
  • 27
1
vote
1 answer

RecyclerView smooth scroll

I'm tring to make smooth scroller to need position in recyclerView. I'm ovverride method smoothScrollToPosition in LinearLayoutManager, and it's work fine. But, I need to set scrolled position on top of screen(if is possible). I also tried…
1
vote
2 answers

RecyclerView intercept scroll and stop scrolling beyond certain location

I am new to Android. I have a recyclerview with LinearLayoutmanager set to enable horizontal scroll. I would like user not scroll beyond certain point which can change dynamically. I will give a example to describe it. Lets say there is a tutorial…