java.lang.IllegalArgumentException: LazyHorizontal...
# compose-android
m
java.lang.IllegalArgumentException: LazyHorizontalGrid's height should be bound by parent. Getting this error for quite some time.. The thing is I have a colum which I want to make vertically scrollable. It contains 1 LazyHorizontalGrid with span=4, and 2 more lazy row beneath it.. Problem is that whenever I am adding vertical scroll modifier it throws aboce exception and the app crashes.
I tried by making the outer column to be lazy column but sill facing the same issue
v
The exception is trying to tell that you can't nest infinitely expanding layouts. You need to define a maximum height for the inner LazyGrid.
If you wouldn't do this, the grid would just fill up all space in the scrollable layout because it will allow infinite height for the content.
So give a Modifier.heightIn(max = [something].dp)
m
The thing is that the height of the items of LazyGrid is unknown to me how do I find out its items heights before hand?
v
How high do you want the grid to be? Screen height? A fixed amount of rows dependant on the item heights?
m
the height of the items are known to me... But I want 4 rows and based on this I need the size of parent
409 Views