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

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 75

  • @revel-raza
    @revel-raza 2 месяца назад +4

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

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

  • @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 RUclips/Google algorithim works very well. Keep it up man.

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

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

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

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

  • @talhac2796
    @talhac2796 6 месяцев назад +1

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

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

  • @ravikumarmohan1415
    @ravikumarmohan1415 4 месяца назад +1

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

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

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

  • @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?

  • @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?

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

  • @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?

  • @PrashantSingh-d97
    @PrashantSingh-d97 2 года назад +1

    It was quite interesting and informative.

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

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

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

  • @dolakrishnanseshachalam3028
    @dolakrishnanseshachalam3028 Год назад

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

  • @Deathfang89
    @Deathfang89 2 года назад

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

  • @NateRidderman-du8jv
    @NateRidderman-du8jv 10 месяцев назад

    So helpful!

  • @shahriarzaman4715
    @shahriarzaman4715 Год назад

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

  • @mridulbarman027
    @mridulbarman027 2 года назад

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

  • @osamasayed4086
    @osamasayed4086 10 месяцев назад

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

  • @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?

  • @codefathermw
    @codefathermw Год назад

    Landila ulemu wako @Phillip. 👍👍👍

  • @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 😊

  • @deadPoolPlay9491
    @deadPoolPlay9491 2 года назад

    How about LazyverticalGrid in Lazycolumn ????

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

  • @jayantkumar1954
    @jayantkumar1954 2 года назад

    Helpful 👍

  • @LucasYamato
    @LucasYamato 2 года назад

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

  • @sayyid5416
    @sayyid5416 6 месяцев назад

    Is this improved as of now or still same?

  • @Static1248
    @Static1248 9 месяцев назад

    MAGICAL!!!!!!!!!!

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

  • @PurelyAndroid
    @PurelyAndroid 3 месяца назад

    great content.

  • @mustafaammar551
    @mustafaammar551 2 года назад

    you are the best

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

  • @andrewdunbar828
    @andrewdunbar828 Год назад

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

  • @liaozhangpeng4436
    @liaozhangpeng4436 3 месяца назад

    Nested LazyColumn is still not allowed in jetpack compose

  • @milon27
    @milon27 2 года назад

    thanks

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

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

  • @andrewdunbar828
    @andrewdunbar828 Год назад

    welcome back to my new comment

  • @maxyablochkin-0505
    @maxyablochkin-0505 2 года назад

    Hello with Ukraine👋

  • @John-qt6qk
    @John-qt6qk Год назад

    Thanks

  • @rehan-6377
    @rehan-6377 Год назад

    Thanks