List, Lazy Column, Lazy Row in Jetpack Compose using Kotlin | Android Studio

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone welcome back to my channel in this video we will learn about list lazy columns and lazy rolls in jet pack compos you already know what a list is right it is a set of items to be displayed vertically or horizontally but what are lazy columns and lazy rows I will explain it in detail letter but for now I will say it's a recycler view let's understand three of them in detail with their respective examples I will remove the default code and done this video is divided into three parts the first one is a list second is lazy column and third is lazy row so let's create a simple list see just because it's a jetpack compos project doesn't mean that cine is something different here no cine is the same only the design is changed hence the logic to create a list is still going to be the same so how do we create a list right well fruits list is equal to the list of and here inside the brackets we will mention a list of all the fruits simple then here we will create a composable function display list to display the fruits list as their parameter also don't forget to call the compos function here inside the set content and done now how do we display a list so we have to create a logic in such a way that each item is been iterated in the list got it now I want my list to be vertical hence I'll go for a column layout but if I wanted my list to be horizontal then I would have gone for row layout inside the column layout we have to iterate through each item in the list so to do that write fruits list dot for each for each is used for iteration purpose then inside for each I'll customize the item text is it means the item that is present in the list with a font size of 30 SP and a color of red and that's it all list is ready now let's run the app and see our list is working perfectly fine now here comes the twist I have five items in it let's add more items okay now let's apply the changes and run the app again the app is lagging it's freezed it's not scrolling what does that mean it simply means that the list was working fine till the time it had limited items in it correct but as soon as I added more items to it the list could not bear it it started lagging basically a list with so many items in it leads to a lack of memory performance issues slow process and all of that that's where lazy column and lazy row come into the picture like in XML how we used to have a list with its better version as the recycler view same way here we have a list with its better version as lazy column and lazy rows got it so comment on the previous code now first I'll use a lazy column then a lazy row so instead of a simple column layout I will use lazy column then inside it to iterate through each item we have a simple Concept in lizy column that is to use items see to add a single item we use an item to add multiple items with count we use items with int then if we want to add multiple items through an array then items array and lastly if we want to add multiple items through a list we use items list so as we are using a list hence I'll go for items with a list and what is the list name fruits list then inside it customize the item text is it font size is 30 color is red and that's it our lazy column list is ready now let's run the app and see look the list is scrolling so smoothly without any lag easy right next is the lazy row it's again very simple so the lazy column is vertical while the lazy row is horizontal like how we used to have horizontal recycler view the same way we have lazy row so all you have to do is change the lazy column to Lazy row and that's it our lazy row is ready let's run the app and see look the list is displayed horizontally and that's it let me quickly summarize it so we can use the list for limited items but if we want more items in it to be handled gracefully then we have to go for the lazy column or lazy Row The Lazy column displays the list vertically and the lazy row displays the list horizontally got it so yeah that is it for the video If you new to this channel then please consider subscribing to my channel and I'll see you in the next [Music] video [Music]
Info
Channel: Android Knowledge
Views: 867
Rating: undefined out of 5
Keywords: jetpack, compose, jetpack compose, what is jetpack compose, basics of jetpack compose in android, jetpack compose series in android studio, learn jetpack compose, create an app using jetpack compose, 2024 jetpack compose, android studio, new android studio, latest version, java, kotlin, create an android app, text composable, 2024, android in jetpack compose, lazy column, lazy row, lazy list, list, recyclerview in jetpack compose, listview, lazy recyclerview., lazy jetpack compose
Id: zf6QJemVs2k
Channel Id: undefined
Length: 6min 31sec (391 seconds)
Published: Tue Mar 05 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.