google / flexbox-layout

Flexbox for Android
Apache License 2.0
18.27k stars 1.8k forks source link

RecyclerView with FlexboxLayoutManager laggy #334

Open andrijans opened 7 years ago

andrijans commented 7 years ago

Issues and steps to reproduce

I'm using FlexboxLayoutManager to show news articles on tablet in 2 colums and later in single column or 3 and 2 in landscape. On phone is only one column and it works ok also if I put on tablet to only one column it also works but as soon as there is more than one item in a row it lags like crazy.

all I do is

layoutManager = new FlexboxLayoutManager(getContext(), FlexDirection.ROW);
layoutManager.setJustifyContent(JustifyContent.FLEX_START);
setLayoutManager(layoutManager);

and I calculate width for each item and setting it (thats how I control wanted number of columns) but even without that it still lags.

thagikura commented 7 years ago

Thanks. Can you please try the following?

andrijans commented 7 years ago

I tested your cat gallery and there is no lag. Also I changed it to load images with glide and it still works good. But on my app it lags like crazy. if I disable loading images it is a better but still laggy. Maybe it is just that my items are heavier(I have an imageview and 5 textviews also I have 3 different view types). Strange thing is that with GridLayoutManager works great without any lag. Anyway I can't lose anymore time on this so we adjusted design so I can use GridLayoutManager instead. Thanks for your time

thagikura commented 7 years ago

Thanks for the update and sorry for not being able to help your app. If it's possible to send your app to me privately, I appreciate it to debug the situation. There may be something should be fixed in FlexboxLayoutManager given that GridLayoutManager works well.

andrijans commented 7 years ago

I can't send you app because of NDA but when I get the time I will extract all relevant code and send it to you. Sorry I can't do it now I just don't have time.

thagikura commented 7 years ago

Okay, that totally makes sense. Thanks for your effort that you are going to extract the relevant code.

nvd3012 commented 4 years ago

Hello, thagikura. I have a similar problem. I can send my application to you. I hope you can help and explain the problem to me. I really want to use FlexboxLayoutManager. You can contact me via Skype: nvd3012. Thank you for taking the time.