0

I have a RecyclerView with GridLayoutManager and a button, when i click the button i want to smoothScrollToPosition. My custom view is simply a RelativeLayout containing a TextView. When i run the program on Lollipop everything's fine, i press the button and the application scrolls smoothly to the given position. When i run the same code on pre lollipop devices or virtual machines, i click the button and the app instead of smoothScrolling starts lagScrolling, it scrolls but with so much lag it's not even funny. The same code but with ImageViews instead of TextViews in the custom View doesn't lag, almost at all. Is this a known bug or can it be solved? My code is just a basic implementation of a RecyclerView with adapter but if somebody needs to see it i'll post it.

alessandro gaboardi
  • 889
  • 3
  • 11
  • 26

1 Answers1

-2

Please post your CustomView xml and your adapter code.

You probably set your TextView's width to "wrap_content", and then you probably performing TextView setText() inside adapter, causing it to measure the width of the component again each time onBindViewHolder() is called.

You should try changing TextView width to "match_parent" or some static value in dp.

Please take a look at this question

Community
  • 1
  • 1