Тёмный

Bottom Navigation with Jetpack Compose 

Stevdza-San
Подписаться 85 тыс.
Просмотров 50 тыс.
50% 1

🏆 My Online Courses
⭐Discount Coupon: LAUNCH-STEVDZA-SAN
stevdza-san.com
🐱‍👤 Wanna become a member? Join!
/ @stevdzasan
📸 Instagram
/ stevdza_san
In this video I'm going to show you how to implement Bottom Navigation Bar into your Android application using Compose Navigation! Watch the whole video to learn more about it! :)
💻 Source code: github.com/stevdza-san/Bottom...
⌚Timestamps
0:00 - Introduction
0:35 - Bottom Screen holder class
2:14 - Add MainScreen
3:03 - Create BottomNavGraph
4:30 - Create BottomBar
6:17 - Add Item
9:50 - Recap
10:39 - Run the App
11:28 - Unselected Items Visibility
13:12 - Handle Back Stack
14:40 - Conclusion

Опубликовано:

 

23 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 124   
@gamesforu6619
@gamesforu6619 Год назад
You're the best instructor on youtube, Because you are simplifying the tutorials to everyone who watching your videos, Keep going and never stop Stevdza
@StevdzaSan
@StevdzaSan Год назад
Thanks buddy 💜🙏
@ernestguevara5968
@ernestguevara5968 Год назад
To those whose watching this in mid 2023. If you're having problems importing BottomNavigation and BottomNavigationItem. It's because material3 uses a new one. You can try this one NavigationBar { items.forEachIndexed { index, item -> NavigationBarItem( icon = { Icon(Icons.Filled.Favorite, contentDescription = item) }, label = { Text(item) }, selected = selectedItem == index, onClick = { selectedItem = index } ) } } But still a great vid!
@tristanbocook6311
@tristanbocook6311 7 месяцев назад
youre a god and saved me
@devacc9958
@devacc9958 7 месяцев назад
Thank you very much
@sinbad552
@sinbad552 3 месяца назад
alternative for selected and unselected property in NavigationBarItem?
@duncanmoiyo6069
@duncanmoiyo6069 Год назад
You are the most exceptional RU-vid instructor, effortlessly simplifying every concept. I am gaining a wealth of knowledge from you, and I aspire to become one of the top Android experts in the near future.
@mxgenius753
@mxgenius753 2 года назад
Thank you Stefan, always easy to understand your tutorials. Please keep them coming.
@StevdzaSan
@StevdzaSan 2 года назад
Thanks! Yeah, I'll continue my Jetpack Compose journey, definitely! 🚀😊
@lucasnpc2
@lucasnpc2 2 года назад
Great man! I really appreciate your teaching skills!!
@stineandthebooks
@stineandthebooks Год назад
Thank you - you explain it so well!
@raseenakt8174
@raseenakt8174 2 года назад
Thanks for your work man!!
@StevdzaSan
@StevdzaSan 2 года назад
You're welcome! 🚀
@Lucasgustavom
@Lucasgustavom Год назад
Very good video as always, what I didnt actually like is the navigation with compose, too much complicated when compared to the Navigation Library we already have when working with XML
@AndrewDChristie
@AndrewDChristie 2 года назад
Thanks!
@Guilo583
@Guilo583 2 года назад
Thanks great job. I need more
@StevdzaSan
@StevdzaSan 2 года назад
I will continue uploading videos for Jetpack Compose.
@Wallenlaguinee
@Wallenlaguinee 2 года назад
Really great tutorial. Thank you! What's a good way to handle more than 8 screens? I have seen some apps use a hamburger or a 'more' icon on the right. How could we implement that? A thousand thanks!
@TheParthDesai
@TheParthDesai 2 года назад
Thank you Stefan.
@StevdzaSan
@StevdzaSan 2 года назад
You're welcome buddy! :)
@rc5016
@rc5016 Год назад
Great video!
@NaraveyGaming
@NaraveyGaming 2 года назад
so if i want to add destination ( not for bottom navigation ) , do we need to make another screen class or just add another NavHost on MainScreen ?
@hamzaelmarjani8541
@hamzaelmarjani8541 2 года назад
Thank you for your good tutorial 🙏
@StevdzaSan
@StevdzaSan 2 года назад
Glad I can help buddy! 💜
@ashokmanis2111
@ashokmanis2111 2 года назад
Awesome 🔥
@abdelsttarahmed8821
@abdelsttarahmed8821 2 года назад
Man you are amaizing
@gilsonjuniorpro
@gilsonjuniorpro 2 года назад
Really a great video, thanks
@StevdzaSan
@StevdzaSan 2 года назад
🙌🙌
@rahathossainhimel7177
@rahathossainhimel7177 2 года назад
Wow great ❤️.
@alexaguiar7268
@alexaguiar7268 2 года назад
Good videos!. How can I select the startDestination based on some condition on starting the app?
@turnitsimple3584
@turnitsimple3584 2 года назад
Thanks for the nice explanation. I have some issue when randomly and quickly switched between bottom nav item the app crashes.Can I get some help.
@cub3608
@cub3608 Год назад
nice on stef
@tmjromao
@tmjromao 2 года назад
Many thanks for the explanation. Is it possible to have to more than one scafffold? Meaning 2 or more graphs, one per each bottom navigation item? How to mix each bottom item with its screen flow? Would much appreciate a mix between bottom navigation and multigraph explanation, Many thanks, keep up
@StevdzaSan
@StevdzaSan 2 года назад
Watch my video about nested navigation. 👌
@bijooop7955
@bijooop7955 2 года назад
Amazing, Plz also make a video on how to integrate payment gateway in jetpack compose.
@AkshayTaru
@AkshayTaru 2 года назад
Thank you for Awesome video and the Nested Navigation video. If you check comments lots of people want to know how would you structure following. Like a navGraph for a login flow, and a navGraph for bottom nav when user is logged in Login Screen, MainScreen which has bottom navigation bar. There is no much resource available for this (common) problem. And on stackoverflow few people are trying to solve using Two Navhost with different NavHostController. And nobody knows if this approach is correct. They are using because it works. And I have seen you commenting somewhere that we dont need two NavController for two Navhost. Appreciate if you could make video on this. Would love to see how you would solve the problem.
@StevdzaSan
@StevdzaSan 2 года назад
Yeah I've received a lot of questions about it. I'll definitely think about making video on that topic. 🤔
@irfanalkan4246
@irfanalkan4246 7 месяцев назад
Teşekkürler
@libinmathew2566
@libinmathew2566 2 года назад
How is it possible to show a detail screen from home screen which show as full screen outside bottom screen .
@immohanraj
@immohanraj 11 месяцев назад
Nice
@paulvickers8059
@paulvickers8059 2 года назад
Thanks for detailed tutorials. Have you anything on navigation drawer?
@StevdzaSan
@StevdzaSan 2 года назад
Not yet, I'll keep that in mind for future video tutorials. 👍
@ArnoldWafula
@ArnoldWafula Год назад
Is there a shorter and simpler way to implement this?
@HeraldOD
@HeraldOD 2 года назад
Hey, awesome video. Is there a way to not have content underneath the bottom bar? it seems to be "floating" and overlaps stuff on the bottom of the screen
@StevdzaSan
@StevdzaSan 2 года назад
Check out this answer: stackoverflow.com/questions/66573601/bottom-nav-bar-overlaps-screen-content-in-jetpack-compose
@aagaasavaanii9075
@aagaasavaanii9075 2 года назад
Nice explaination. Can we have the repo link of the sample?
@DavidNitzscheBell
@DavidNitzscheBell Год назад
There are limited ImageVectors to choose from. How can I change this to use a Vector Asset, please?
@souptiknath4668
@souptiknath4668 2 года назад
Make some big projects using jetpack compose
@user-fj8df8gb4b
@user-fj8df8gb4b 5 месяцев назад
How do you pass arguments between bottom navigation screens?
@RomanAisly
@RomanAisly 3 месяца назад
Thanks for your video. I improved MybottomNavigation. It will be greate if make video about images from API service
@senya_tall
@senya_tall Год назад
Отлично
@felipe61307
@felipe61307 Год назад
Muito bom, procurei tutoriais em português, mas não encontrei. Esse deu certo
@moissesfalcao8941
@moissesfalcao8941 5 месяцев назад
I see a fade animation when making transition betwen screens in my app, someone know how to disable that?
@Jerry-of9zj
@Jerry-of9zj 2 года назад
Hello sir, how can I navigate from single screen(splash screen) to bottom navigation screen
@raymondmichael4987
@raymondmichael4987 2 года назад
So this today, good content. Can create a tutorial to work with mongodb realm? Subed
@AidenLin-sq4oh
@AidenLin-sq4oh 2 года назад
Another useful tutorial, thanks a lot. 👍
@StevdzaSan
@StevdzaSan 2 года назад
You're welcome buddy 🙏😉
@zyoyi5612
@zyoyi5612 Год назад
How I can change the color of the bottom bar?
@ryank8463
@ryank8463 2 года назад
Hi, really appreciate this video. I got some problems. The thing is that I use the same way to implement a bottom navigation, but once I trigger the button on one of my screen to navigate to another screen outside the bottom navigation, the app crash immediately. I use the same method to build navigation as in your last video. Can anyone help me?
@StevdzaSan
@StevdzaSan 2 года назад
I'll soon make a video about nested navigation with bottom navigation, in the next week probably. 👍
@valdompinga3790
@valdompinga3790 Год назад
Perfect explanation! Is there a way to change between tabs swipping right or left?
@mikejawoski5904
@mikejawoski5904 Год назад
You'll probably want to implement a ViewPager instead.
@valdompinga3790
@valdompinga3790 Год назад
@@mikejawoski5904 thanks
@user-ed8xj1py6w
@user-ed8xj1py6w Год назад
Hi! How change color Bottom bar ?
@AhmedAli-qm1td
@AhmedAli-qm1td 2 года назад
Thanks a lot Can we make a custom one with rounded corners
@StevdzaSan
@StevdzaSan 2 года назад
Yes we can, I'll think about making a shorts video. Basically you can achieve that with a simple modifier.
@Asair4ik
@Asair4ik 2 года назад
Man, thanks for the video, u are the best. But can u do bottom bar with expandable fab ? i have some problems to do this
@StevdzaSan
@StevdzaSan 2 года назад
Thank you for suggesting, I'll keep that in mind.
@Asair4ik
@Asair4ik 2 года назад
@@StevdzaSan thanks a lot. I ve tried to do it by myself but I have problems wit expanded state, everything is moving downstairs
@hatdot
@hatdot 2 года назад
Hello, How can I hide the Bottom Navigation in the next screen?
@ErdemKalyoncu
@ErdemKalyoncu 2 года назад
Thank you for the video! Is it possible to use BottomNavigation with nested navigation to show it only in MainNavGraph?
@StevdzaSan
@StevdzaSan 2 года назад
You can achieve everything you want, even create two different NavHosts.
@slayer5171
@slayer5171 2 года назад
Yes, this is exactly what I am curious about.
@slayer5171
@slayer5171 2 года назад
@@StevdzaSan How to implement two different navhost?
@cumahaznedar1191
@cumahaznedar1191 2 года назад
​@@slayer5171 Bro, I have this problem, Did you fix that? (Nested Navigation with Bottom Bar)
@slayer5171
@slayer5171 2 года назад
@@cumahaznedar1191 I am using state and just pass a handler to show and hide bottom navigation bar.
@frax84
@frax84 2 года назад
Thank you for your interesting tutorials! If possible, i have a question. Based on this video and the previous one (Nested Navigation), is it possible to achieve an architecture where you have a navigation like Screen -> Screen with Bottom Navigation Bar and then navigating using Navigation Bar? Thank you!
@StevdzaSan
@StevdzaSan 2 года назад
Everything that can be achieved with Navigation component can be achieved with Compose Navigation as well.
@frax84
@frax84 2 года назад
@@StevdzaSan That's a wise answer xD. I asked because I don't get how you can manage the NavHost in such situation. In fact, for standard Screen2Screen navigation NavHost is usually called at high scope (let's say in setContent function) while in the NavBottomBar case you call it in the innerpadding scope of Scaffold composable to avoid making the NavBottomBar disappear at every transaction
@StevdzaSan
@StevdzaSan 2 года назад
@@frax84 Watch my video about nested navigation, you can have multiple nav graphs in your app 👍: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2sKnGloDJf0.html
@frax84
@frax84 2 года назад
@@StevdzaSan Yes i already watched (and liked!) it. Unfortunately i am not able to apply it to my case. Probably what i would need would be 2 different NavController to associate with 2 different NavHost: one in charge of Splash->MainScreen navigation, the second one in charge of navigating with BottomNavBar. Because i'm a noob, i don't know how to get 2 NavControllers -.-'
@StevdzaSan
@StevdzaSan 2 года назад
@@frax84 You don't need two Nav Controllers for two NavHost's. You can pass one to both of them.
@user-fy6bo7ng6o
@user-fy6bo7ng6o Год назад
If you die you are a legend!
@kios1973
@kios1973 2 года назад
thanks for this, is there a way to prevent the page from reloadin everytime you reopen it?
@StevdzaSan
@StevdzaSan 2 года назад
Save and restore screen state with nav controller when navigating away.
@indiebloog6785
@indiebloog6785 Год назад
how to change background color sir
@rpitpatel1004
@rpitpatel1004 2 года назад
Thank you for tutorial Sir. unselectedContentColor parameter not working for me. How do I fix that? I am switching to dark mode and my app is not changing colour according to the theme.
@rpitpatel1004
@rpitpatel1004 2 года назад
Found an error in my code. I did not wrap my scaffold in my app theme. 😊 But unselectedContentColor parameter not working for me. Do you have any suggestions for that?
@cufflink919
@cufflink919 2 месяца назад
Someone posted a fix on the next video in the playlist. "... use NavigationBar and NavigationBarItem from material3 in place of BottomNavigation and BottomNavigationItem"
@deepakchoudhary7712
@deepakchoudhary7712 2 года назад
Again, You are better than Phillps L. lol
@maximkarassev1016
@maximkarassev1016 2 месяца назад
Thanks for this video! But slow down please.
@luisguilhermeloubacksouza1399
@luisguilhermeloubacksouza1399 4 месяца назад
Música?
@nullpointer57
@nullpointer57 Год назад
Imagine spending 10minutes to set up a Bottom Nav bar with the speed of Author. In old layout, a newbie can set up navigation bar in 2 minutes.
@datel666
@datel666 Год назад
Cant use delegate currentBackStackEntryAsState() 5:40 also scaffold gives an error - Content padding parameter it is not used 1) fixed delegate with some kind of import with alt+enter that for some reason wasnt added automatically 2) Scaffold fix = @SuppressLint("UnusedMaterialScaffoldPaddingParameter") annonation. Omg compose is garbage. Thx for video anyway
@siva_subramaniam
@siva_subramaniam Год назад
Bm - 11:28
@SaratNath-ei9mr
@SaratNath-ei9mr Год назад
BottomNavigation and BottomNavigationItem is not working right now
@gara7723
@gara7723 8 месяцев назад
Did you find out the solution?
@sadiquereyaz
@sadiquereyaz 5 месяцев назад
exactly
@rosylinemilia6123
@rosylinemilia6123 3 месяца назад
Add the dependency i.e androidx. compose .material: material :1.6.5
@gkozgkeiros5750
@gkozgkeiros5750 16 дней назад
this is 10x times easier than xml way
@susantkumar2889
@susantkumar2889 11 месяцев назад
But you are not explaining , you are reading what ever you are writing
@SahilRai2
@SahilRai2 Год назад
You made it too long. Like if you're going to use this in bigger projects, this could make things confusing
@BAAAAAAAAAAA
@BAAAAAAAAAAA 11 месяцев назад
Very frustrating to follow, you do things way to quickly
@rahulsharma5386
@rahulsharma5386 6 месяцев назад
Jetpack Compose involves too much coding; it's the worst. Who suggested it to Google ? Jetpack Compose seems like a step backward, reminiscent of the early stages of Android development.
@funnymoment9164
@funnymoment9164 2 года назад
Thanks!
@AndrewDChristie
@AndrewDChristie 2 года назад
Thanks!
@StevdzaSan
@StevdzaSan 2 года назад
Thanks again Andrew! 🙏❤
@madbuds
@madbuds 2 года назад
Thanks!
@madbuds
@madbuds 2 года назад
Nice video! But what if I wanted to use on tab Icons, resources of my own? I have accomplished that using a R.drawable resource and using painter on Icon(). But i guess this way I cannot achieve the unselectedContentColor the way you did.
@StevdzaSan
@StevdzaSan 2 года назад
Hm, I haven't tried that. I guess you could try changing it's alpha state instead.
@madbuds
@madbuds 2 года назад
@@StevdzaSan it works. Thanks a lot! Keep up the good job!
@madbuds
@madbuds 2 года назад
Imagine the following scenario: what if need a authentication flow before rendering this bottom tab nav graph... like a navGraph for a login flow, and a navGraph for bottom nav when user is logged in... How would you structure this kind of navigation?