Recyclerlistview: How can I use dynamic height for layout provider?

Created on 29 Jan 2019  路  6Comments  路  Source: Flipkart/recyclerlistview

I want to be height of the list-item dynamic.
In layout provider I set it to 50 but when the I increase font size text overlapped with next line. It is because list item height remains 50 because it is set by layout provider.

How can I made list item height dynamic??
Any alternative to forceNonDeterministicRendering=true ?

Please help asap.

Most helpful comment

I was also wondering if this is possible

All 6 comments

I was also wondering if this is possible

If you can somehow compute the exact height your text element will take post rendering, you can set forceNonDeterministicRendering as false (do check getDataForIndex() functionality that can be used within a layout provider). But if you are not really sure about the exact height and it's quite variable, I would suggest to let RecyclerListView take care of it and set non deterministic rendering as true. That, obviously, comes with a little performance hit when compared with the deterministic approach.

@naqvitalha please add if I missed something here!

forceNonDeterministicRendering={true} shows next line in same line. And Lines are animating on first load.

Means If second line has 4 characters only, It automatically adjust in first line and animating.
Any help please!!

It can be possible if state change can also change the height of the layout provider. How can I achieve this?

Or any other way?

@ErHarinderSingh In the first render pass your estimates are considered for item placement and then actuals are used. One quick hack could be to disable animation and hide the list view for 1-2 frames. Not that I recommend it :)

I could not find a way to render rows vertically when using forceNonDeterministicRendering as true. Any help?

@VictorQueiroz Could you provide a snack expo for us look at? Ideally the rows should render irrespective of whether forceNonDeterministicRendering is set to true or not. It is possible that the width has not been provided as it has to be provided manually when forceNonDeterministicRendering is set to true.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nehacurefit picture nehacurefit  路  4Comments

waheedakhtar694 picture waheedakhtar694  路  6Comments

LukaszK88 picture LukaszK88  路  6Comments

sm2017 picture sm2017  路  5Comments

h-asadollahi picture h-asadollahi  路  8Comments