The FULL Nested Scrolling Guide for Jetpack Compose 😱 - Android Studio Tutorial

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 75

  • @revel-raza
    @revel-raza 2 місяці тому +5

    At this point I think I forgot how many times you had saved my job. Thanks man!!

  • @scottbiggs8894
    @scottbiggs8894 Місяць тому

    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).
    🤓🎆

  • @hoplite_softworks
    @hoplite_softworks 8 місяців тому +1

    YOU LITERALLY SAVED MY PROJECT ! THANK YOU X 1000000 !!!

  • @pitorszpitor6679
    @pitorszpitor6679 2 роки тому

    If I look left see Philipp new video than look right same than look around Philipp still there with this compose. This UA-cam/Google algorithim works very well. Keep it up man.

  • @dreamerslab
    @dreamerslab Рік тому +8

    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.

  • @OliverRhyme
    @OliverRhyme 2 роки тому +20

    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.

    • @TVHovna
      @TVHovna 2 роки тому

      😱

    • @deepakbisht4957
      @deepakbisht4957 Рік тому +1

      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...

    • @andrewdunbar828
      @andrewdunbar828 Рік тому

      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.

  • @saketanand9157
    @saketanand9157 2 роки тому

    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.

  • @Landofcoding
    @Landofcoding 2 роки тому +11

    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.

    • @SoulWithoutFaith
      @SoulWithoutFaith Рік тому +3

      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.

  • @cesarlabastida1392
    @cesarlabastida1392 Рік тому

    Brother I was having this issue at my job. Thanks for you videos they are ver helpful

  • @JahangirJadi
    @JahangirJadi Рік тому +1

    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.

  • @mrunalpatil5913
    @mrunalpatil5913 2 роки тому +1

    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❤️

  • @talhac2796
    @talhac2796 6 місяців тому +1

    I have a LazyVerticalGrid inside a item list in a LazyColumn. What about my situation? How can i solve it?

  • @ravikumarmohan1415
    @ravikumarmohan1415 4 місяці тому +1

    What if there is a Lazy Vertical Grid inside the lazy column? Could someone help answering this question?

  • @9iht6ihgt43rzhijj
    @9iht6ihgt43rzhijj 5 місяців тому

    Very helpful (yet again ^^).

  • @fireninja6464
    @fireninja6464 2 роки тому

    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.

    • @GoodSmile3
      @GoodSmile3 2 роки тому

      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.

  • @shahriarzaman4715
    @shahriarzaman4715 2 роки тому

    😱 That easy!!! Thnks. May Allah guide you..

  • @PrashantSingh-d97
    @PrashantSingh-d97 2 роки тому +1

    It was quite interesting and informative.

  • @romanhruska7402
    @romanhruska7402 6 місяців тому

    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?

  • @codefathermw
    @codefathermw Рік тому

    Landila ulemu wako @Phillip. 👍👍👍

  • @NateRidderman-du8jv
    @NateRidderman-du8jv 10 місяців тому

    So helpful!

  • @ruavaen
    @ruavaen 2 роки тому

    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 .

  • @Deathfang89
    @Deathfang89 2 роки тому

    What theme are you using for in these videos in AS?

  • @agustinsivoplas3330
    @agustinsivoplas3330 Рік тому

    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?

  • @TheLatvianboy
    @TheLatvianboy 2 роки тому +3

    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.

    • @PhilippLackner
      @PhilippLackner  2 роки тому

      Oh nice gotta try this

    • @SoulWithoutFaith
      @SoulWithoutFaith Рік тому

      Does it work with pagination? Or does it just fetch everything in this case?

    • @19SOUNDS90
      @19SOUNDS90 Рік тому +1

      this is an awesome answer and did exactly what i needed! thanks

    • @johnshepard1267
      @johnshepard1267 Рік тому

      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?

  • @eganathan.r
    @eganathan.r Рік тому

    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.....

  • @mridulbarman027
    @mridulbarman027 2 роки тому

    For now if we use java xml component with nested recycler view inside compose, will that work?

  • @anirbanroy6337
    @anirbanroy6337 Рік тому

    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?

  • @dolakrishnanseshachalam3028

    Hi @Philipp
    I have Lazy Column Inside HorizontalPager and insider this I have LazyColumsn how we can achieve this

  • @mrchispa4541
    @mrchispa4541 Рік тому

    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.

  • @PurelyAndroid
    @PurelyAndroid 4 місяці тому

    great content.

  • @LasradoRohan
    @LasradoRohan 2 роки тому

    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.

  • @Static1248
    @Static1248 9 місяців тому

    MAGICAL!!!!!!!!!!

  • @matussatara2609
    @matussatara2609 2 роки тому

    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

    • @maskedredstonerproz
      @maskedredstonerproz 2 роки тому

      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

    • @matussatara2609
      @matussatara2609 2 роки тому

      @@maskedredstonerproz i tried everything. Didn't get it to work 😊

  • @jayantkumar1954
    @jayantkumar1954 2 роки тому

    Helpful 👍

  • @deadPoolPlay9491
    @deadPoolPlay9491 2 роки тому

    How about LazyverticalGrid in Lazycolumn ????

  • @LucasYamato
    @LucasYamato 2 роки тому

    Hey bro, all right? puts caption pt/br in the videos of your course please

  • @mustafaammar551
    @mustafaammar551 2 роки тому

    you are the best

  • @osamasayed4086
    @osamasayed4086 10 місяців тому

    Is this issue still present in Jetpack Compose at this time?

  • @robinwersich3424
    @robinwersich3424 Рік тому

    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

  • @sayyid5416
    @sayyid5416 6 місяців тому

    Is this improved as of now or still same?

  • @Infonation108
    @Infonation108 2 роки тому

    "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

    • @maskedredstonerproz
      @maskedredstonerproz 2 роки тому

      1. google it, 2. or tell us something we can use to help you, you didn't say anything

  • @milon27
    @milon27 2 роки тому

    thanks

  • @andrewdunbar828
    @andrewdunbar828 Рік тому

    I'm going to name my new band "Lazy Cullem".

  • @jjhoninatan55sabadi
    @jjhoninatan55sabadi 2 роки тому

    How about nest scroll connection? Won't it work ?

    • @PhilippLackner
      @PhilippLackner  2 роки тому +1

      It's to use nested scroll with recyclerview and lazy column

  • @liaozhangpeng4436
    @liaozhangpeng4436 4 місяці тому

    Nested LazyColumn is still not allowed in jetpack compose

  • @GoodSmile3
    @GoodSmile3 2 роки тому +2

    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

    • @best5345
      @best5345 2 роки тому +1

      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.

  • @d_o_o_m_g_u_y
    @d_o_o_m_g_u_y Рік тому

    Surprisingly frustrating coming from a flutter background. But thanks alot

  • @abdy9415
    @abdy9415 2 роки тому

    Thanks, how to use tik tok API

  • @maxyablochkin-0505
    @maxyablochkin-0505 2 роки тому

    Hello with Ukraine👋

  • @andrewdunbar828
    @andrewdunbar828 Рік тому

    welcome back to my new comment

  • @deepakbisht4957
    @deepakbisht4957 Рік тому

    Instead of all this mess you should use Flow Column...

    • @PhilippLackner
      @PhilippLackner  Рік тому +1

      That's something completely different and hasn't lazy loading behavior at all

    • @deepakbisht4957
      @deepakbisht4957 Рік тому

      @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...

    • @deepakbisht4957
      @deepakbisht4957 Рік тому

      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?

    • @PhilippLackner
      @PhilippLackner  Рік тому

      @@deepakbisht4957 what you mean is a LazyStaggeredGrid

  • @pavelgorbatyuk7270
    @pavelgorbatyuk7270 Рік тому

    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

  • @John-qt6qk
    @John-qt6qk 2 роки тому

    Thanks

  • @rehan-6377
    @rehan-6377 Рік тому

    Thanks