6:23 "Extend the lazylist scope"! This one sentence was exactly what I was looking for, thank you! I didn't even know that was possible (suspected something like that could be done, but never saw an example--or at least didn't understand what I was reading). 🤓🎆
Flutter has really amazing support for scrolling components. It's dead easy to implement grids, lists in single scrollable parent. It would be great if compose could improve these basic issues in upcoming releases.
If I look left see Philipp new video than look right same than look around Philipp still there with this compose. This RUclips/Google algorithim works very well. Keep it up man.
This is helpful, but it could get more complicated if you want to implement gridItems with nested scrolling. i think the Android team should do something about this in the upcoming versions of compose.
It looks like working if LazyVerticalGrid is used as parent lazy composable. Use item() DSL for your horizontal shelves together with GridItemSpan to get correct UI. And for grid just use items() DSL as in this video.
Thanks Philipp !. I ran into this problem couple of months back. So, what I did was, just use items block to implement the nested LazyColumn. I was unaware of the fact that I could have just used LazyListScope.
With the nested RecyclerView, there is actually a problem. It does not recycle items as RecyclerView is given infinite height so RecyclerView thinks your screen is also infinitely high, thus renders all the child. Very dangerous for paging as it loads all the data till the end.
Of course when you nest the Recycler view inside Scroll view in XML things works but Recycler view lost it's recycling Power that's why Compose is restricting us from the starting with this approach that many developers use in case of Xml...
Hi. Thank you. This video really helped and confused me at the same time. So, what if I have LazyColumn inside a Column because this trick won't work if we have a column instead of a lazyColumn.
Hi Phil, this one is not related to this video but really wanted to know your view about Robolectric testing? Using Espresso in robolectric testing? How should both be integrated? What is proper way to use robolectric? So many questions I have can't get a proper video anywhere. Can you please make one .. your videos are easier to understand.. Also thank you for all the knowledge you keep giving us❤️
I have a drop down that's a lazy nested column. I gave each item a static height and gave the nested lazy column a height of items.size * item height and animate from 0 to that height when you click the drop down. Probably not the best solution in terms of accessibility but it works.
Haha I did the same thing for the same problem. Also had dropdown as a nested column, assigned height to each item and then multiplied with the list size. However in my case user could also expand any item inside the nested column, so the height could be changed, had to also keep that in mind.
I remember having a project with compose 1.0 where we had the main composable a lazy column and the inner columns normal columns. The instrumented tests showed that the nodes of the inside column that were not in the screen didn't actually existed yet, so we concluded that the lazy part of the main column would render all the content lazy loaded (at least from the rendering side). The objects supporting the columns's data will exist in the viewmodel anyway so we stopped trying to optimize that any further. I would like you to try this again in the latest versions of compose, maybe the behavior didn't change and we are worrying about nothing .
What if I have a list of lists of item (eventual LazyColumn nested inside LazyColumn) but I need to apply some UI tweaks to the sub-lists? Such as background color, border.. etc? Like --- HEADER 1 --- { Section 1 item 1 } { Section 1 item 2 } { Section 1 item 3 } --- HEADER 2 ---- { Section 2 item 1 } { Section 2 item 2 } and each section of items should be contained as a box/column - layout that would visually group the items. How to do that?
Whats happens if I have a TabRow, with Horizontal pager and the LazyColumn lives inside the pager and I want to make all the view scrollable. So the Tabs has to scroll too. Any idea how to solve this?
We had the excel sheet type report screen where we wanted the first value of the row and the header to be floating, had to give specific height depending on the number of contents.....
can you please give me this answer :: into SubList2 i am using use LazyVerticalGrid , not LazyColumn or Column , then app is crashing , is there any possible solution for this?
Hey, could you also keep making view system tutorials, cause as of now, advanced views like "sectioned recycler view" are still obscure, and there aren't any good tutorials.
Does google presented any solution to this ? Is pretty common to have this situation. Ussually every app has a scroll if the content doesn't fit in the screen.
Ran into this quite a ferw times as well, easiest solution for me was to just set Modifier.heightIn(max= *some crazy high dp value*) for the inner lazyColumn. This keeps Compose happy as it provides an upper height bound but in reality yhis keeps the nested scroll, and keeps the inner scroll view as wrap content height, expanding only when needed.
I have a Column with vertical Scroll and LazyVerticalGrid. Tried to set Modifier.heightIn(max = 1000000.dp) and the app still crashes but with different error "Can't represent a size of 281250 in Constraints" Howerer if I put 10000 - its fine. But will 10k dp be enough?
Thanks for the video, Do you have any idea how to update the state of items in LazyColumn? Let's say that you have a list of images, You want to display them with a hearth icon in the corner. When you click the hearth icon the hearth becomes red. I had problem implementing this. My LazyColumn items's hearth color was updated only when i scrolled the item out of sight and back
What you wanna do is have a data class ImageItem( val imageUri: Uri, // or whatever other reference to the image you have val isLiked: Boolean = false // or whatever the heart represents if not liking, you get the point ) // then: val state = mutableStateListOf() // populate the state, and then: LazyColumn { items( items = state, itemContent = { // item display logic } ) } // if you're doing it with mutableStateList() and it's not working then idk
Hey Philipp - first off: Thank you for your videos, they did help me :) Some feedback though: I wish you sometimes would go deeper into topics and not stay so superficial. If you call your video FULL GUIDE, I would expect you to at least also talk about NestedScrollConnection and NestedScrollDispatcher
That's stupid they never added some kind of nesting support. When I found out about this I actually got quite disappointed about compose. Like ye, no more recyclerview, but at what cost
@Philipp Lackner true! This is not for every single scenario but it's good for the scenario where vertical sections are small and don't need much recycling. Otherwise we can also create section headers with expand option with animation...
Hey Philipp how exactly are you managing this in your own project? Suppose you have many sections vertically and in each section we have a different type of list present with their own headers?
this is not a full nested scrolling guide. Almost useless video as it is simply a part of official documentation. Better would be to show the case when the horizontal is fixed and not scrolled together with the whole container
At this point I think I forgot how many times you had saved my job. Thanks man!!
6:23 "Extend the lazylist scope"! This one sentence was exactly what I was looking for, thank you! I didn't even know that was possible (suspected something like that could be done, but never saw an example--or at least didn't understand what I was reading).
🤓🎆
Flutter has really amazing support for scrolling components. It's dead easy to implement grids, lists in single scrollable parent. It would be great if compose could improve these basic issues in upcoming releases.
same in swift ui
YOU LITERALLY SAVED MY PROJECT ! THANK YOU X 1000000 !!!
If I look left see Philipp new video than look right same than look around Philipp still there with this compose. This RUclips/Google algorithim works very well. Keep it up man.
This is helpful, but it could get more complicated if you want to implement gridItems with nested scrolling.
i think the Android team should do something about this in the upcoming versions of compose.
It looks like working if LazyVerticalGrid is used as parent lazy composable. Use item() DSL for your horizontal shelves together with GridItemSpan to get correct UI. And for grid just use items() DSL as in this video.
Thanks Philipp !. I ran into this problem couple of months back. So, what I did was, just use items block to implement the nested LazyColumn. I was unaware of the fact that I could have just used LazyListScope.
With the nested RecyclerView, there is actually a problem. It does not recycle items as RecyclerView is given infinite height so RecyclerView thinks your screen is also infinitely high, thus renders all the child. Very dangerous for paging as it loads all the data till the end.
😱
Of course when you nest the Recycler view inside Scroll view in XML things works but Recycler view lost it's recycling Power that's why Compose is restricting us from the starting with this approach that many developers use in case of Xml...
All the child inside of us,
Will soar into the sun,
We'll leave our fears and doubts behind,
And let our true selves run.
Brother I was having this issue at my job. Thanks for you videos they are ver helpful
Hi. Thank you. This video really helped and confused me at the same time. So, what if I have LazyColumn inside a Column because this trick won't work if we have a column instead of a lazyColumn.
I have a LazyVerticalGrid inside a item list in a LazyColumn. What about my situation? How can i solve it?
Hi Phil, this one is not related to this video but really wanted to know your view about Robolectric testing? Using Espresso in robolectric testing? How should both be integrated? What is proper way to use robolectric? So many questions I have can't get a proper video anywhere. Can you please make one .. your videos are easier to understand..
Also thank you for all the knowledge you keep giving us❤️
What if there is a Lazy Vertical Grid inside the lazy column? Could someone help answering this question?
Very helpful (yet again ^^).
I have a drop down that's a lazy nested column. I gave each item a static height and gave the nested lazy column a height of items.size * item height and animate from 0 to that height when you click the drop down. Probably not the best solution in terms of accessibility but it works.
Haha I did the same thing for the same problem. Also had dropdown as a nested column, assigned height to each item and then multiplied with the list size. However in my case user could also expand any item inside the nested column, so the height could be changed, had to also keep that in mind.
I remember having a project with compose 1.0 where we had the main composable a lazy column and the inner columns normal columns. The instrumented tests showed that the nodes of the inside column that were not in the screen didn't actually existed yet, so we concluded that the lazy part of the main column would render all the content lazy loaded (at least from the rendering side). The objects supporting the columns's data will exist in the viewmodel anyway so we stopped trying to optimize that any further. I would like you to try this again in the latest versions of compose, maybe the behavior didn't change and we are worrying about nothing .
What if I have a list of lists of item (eventual LazyColumn nested inside LazyColumn) but I need to apply some UI tweaks to the sub-lists? Such as background color, border.. etc?
Like
--- HEADER 1 ---
{ Section 1 item 1 }
{ Section 1 item 2 }
{ Section 1 item 3 }
--- HEADER 2 ----
{ Section 2 item 1 }
{ Section 2 item 2 }
and each section of items should be contained as a box/column - layout that would visually group the items.
How to do that?
Whats happens if I have a TabRow, with Horizontal pager and the LazyColumn lives inside the pager and I want to make all the view scrollable. So the Tabs has to scroll too. Any idea how to solve this?
We had the excel sheet type report screen where we wanted the first value of the row and the header to be floating, had to give specific height depending on the number of contents.....
can you please give me this answer :: into SubList2 i am using use LazyVerticalGrid , not LazyColumn or Column , then app is crashing , is there any possible solution for this?
It was quite interesting and informative.
Hey, could you also keep making view system tutorials, cause as of now, advanced views like "sectioned recycler view" are still obscure, and there aren't any good tutorials.
"Invalid encoding of byte 1 of 1-byte in UTF 8 sequence"
I am getting this error while building my app,
Plzz tell me way to fix it
1. google it, 2. or tell us something we can use to help you, you didn't say anything
Does google presented any solution to this ? Is pretty common to have this situation. Ussually every app has a scroll if the content doesn't fit in the screen.
Hi @Philipp
I have Lazy Column Inside HorizontalPager and insider this I have LazyColumsn how we can achieve this
What theme are you using for in these videos in AS?
So helpful!
😱 That easy!!! Thnks. May Allah guide you..
For now if we use java xml component with nested recycler view inside compose, will that work?
Is this issue still present in Jetpack Compose at this time?
Ran into this quite a ferw times as well, easiest solution for me was to just set Modifier.heightIn(max= *some crazy high dp value*) for the inner lazyColumn. This keeps Compose happy as it provides an upper height bound but in reality yhis keeps the nested scroll, and keeps the inner scroll view as wrap content height, expanding only when needed.
Oh nice gotta try this
Does it work with pagination? Or does it just fetch everything in this case?
this is an awesome answer and did exactly what i needed! thanks
I have a Column with vertical Scroll and LazyVerticalGrid. Tried to set Modifier.heightIn(max = 1000000.dp) and the app still crashes but with different error "Can't represent a size of 281250 in Constraints" Howerer if I put 10000 - its fine. But will 10k dp be enough?
Landila ulemu wako @Phillip. 👍👍👍
Thanks for the video, Do you have any idea how to update the state of items in LazyColumn?
Let's say that you have a list of images, You want to display them with a hearth icon in the corner. When you click the hearth icon the hearth becomes red.
I had problem implementing this. My LazyColumn items's hearth color was updated only when i scrolled the item out of sight and back
What you wanna do is have a data class ImageItem(
val imageUri: Uri, // or whatever other reference to the image you have
val isLiked: Boolean = false // or whatever the heart represents if not liking, you get the point
)
// then:
val state = mutableStateListOf()
// populate the state, and then:
LazyColumn {
items(
items = state,
itemContent = {
// item display logic
}
)
}
// if you're doing it with mutableStateList() and it's not working then idk
@@maskedredstonerproz i tried everything. Didn't get it to work 😊
How about LazyverticalGrid in Lazycolumn ????
Hey Philipp - first off: Thank you for your videos, they did help me :)
Some feedback though: I wish you sometimes would go deeper into topics and not stay so superficial. If you call your video FULL GUIDE, I would expect you to at least also talk about NestedScrollConnection and NestedScrollDispatcher
Helpful 👍
Hey bro, all right? puts caption pt/br in the videos of your course please
Is this improved as of now or still same?
MAGICAL!!!!!!!!!!
How about nest scroll connection? Won't it work ?
It's to use nested scroll with recyclerview and lazy column
great content.
you are the best
That's stupid they never added some kind of nesting support. When I found out about this I actually got quite disappointed about compose. Like ye, no more recyclerview, but at what cost
I mean, I really hate compose because of this. This is so basic. I wonder who sat in his office and said, from now every list will be flattened.
I'm going to name my new band "Lazy Cullem".
Nested LazyColumn is still not allowed in jetpack compose
thanks
Surprisingly frustrating coming from a flutter background. But thanks alot
Thanks, how to use tik tok API
Instead of all this mess you should use Flow Column...
That's something completely different and hasn't lazy loading behavior at all
@Philipp Lackner true! This is not for every single scenario but it's good for the scenario where vertical sections are small and don't need much recycling.
Otherwise we can also create section headers with expand option with animation...
Hey Philipp how exactly are you managing this in your own project?
Suppose you have many sections vertically and in each section we have a different type of list present with their own headers?
@@deepakbisht4957 what you mean is a LazyStaggeredGrid
this is not a full nested scrolling guide. Almost useless video as it is simply a part of official documentation. Better would be to show the case when the horizontal is fixed and not scrolled together with the whole container
welcome back to my new comment
Hello with Ukraine👋
Thanks
Thanks