1 00:00:00,810 --> 00:00:03,390 Hello I'm GAFCON and welcome. 2 00:00:03,450 --> 00:00:09,030 Demand what tutorials in today's video we'll be talking about bottom navigation. 3 00:00:09,180 --> 00:00:10,940 So what is it. 4 00:00:10,950 --> 00:00:16,290 It is a menu at the bottom of the screen to navigate between views of fragments. 5 00:00:16,800 --> 00:00:18,540 So let's get started. 6 00:00:18,630 --> 00:00:26,950 Let's create a new project K let's call our projects a bottom navigation menu tutorials. 7 00:00:27,150 --> 00:00:34,480 So bottom nav menu do look to the next button. 8 00:00:35,580 --> 00:00:37,310 Let's keep on minimum as the guest theme. 9 00:00:37,310 --> 00:00:37,780 Why. 10 00:00:37,950 --> 00:00:42,810 So that we can run our application on almost 100 percent of the devices running Android in the world. 11 00:00:43,380 --> 00:00:46,440 Let's hit the next button. 12 00:00:46,500 --> 00:00:50,650 Let's start with an empty activity let's call a doctor. 13 00:00:50,670 --> 00:00:52,440 This may not duty. 14 00:00:52,440 --> 00:00:53,640 Let's hit the finish button. 15 00:00:55,390 --> 00:00:57,560 Well I'm ready to do this building up project. 16 00:00:57,560 --> 00:01:01,120 So let's wait what about this bill. 17 00:01:01,210 --> 00:01:05,300 I'm excited to go well to use a bottom navigation view. 18 00:01:05,370 --> 00:01:07,220 They need to order dependency on the grid. 19 00:01:07,330 --> 00:01:08,530 So let's do that first. 20 00:01:08,950 --> 00:01:13,950 So coming to greater obligation greater on let's other dependency issue. 21 00:01:14,200 --> 00:01:16,240 So implementation 22 00:01:22,500 --> 00:01:35,140 gone dot Android dot support design and religion which is twenty six one to one point zero let's degree 23 00:01:35,200 --> 00:01:35,680 dosing. 24 00:01:35,700 --> 00:01:45,080 Now let's wait Well McGraw don't think we're ready to do the design support library so let's close this 25 00:01:45,720 --> 00:01:46,420 on. 26 00:01:46,850 --> 00:01:48,350 Let's just close this as well. 27 00:01:48,350 --> 00:01:54,740 Coming to Our allowed five first let's get rid of this constraint layout so to use a bottom navigation 28 00:01:54,750 --> 00:01:59,800 view the building level or the main there should be a coordinator level. 29 00:01:59,840 --> 00:02:01,150 So let's add that here. 30 00:02:01,790 --> 00:02:09,050 So according to do layout let's come down here and let us know what navigation view. 31 00:02:09,770 --> 00:02:16,420 So bottom navigation view you have much bearing high drop content. 32 00:02:17,150 --> 00:02:25,780 Let's remove this and this requires you to examine the file and populate the navigation menus. 33 00:02:25,800 --> 00:02:27,000 So let's create one. 34 00:02:27,090 --> 00:02:30,650 So coming to project obligation resources. 35 00:02:30,870 --> 00:02:39,690 Let's create a new resource directory so unregistered directory let's call that menu on the top. 36 00:02:39,760 --> 00:02:47,970 OK again going to menu right click new menu resource file. 37 00:02:48,300 --> 00:02:51,590 Let's call it bottom menu. 38 00:02:52,390 --> 00:02:53,800 And that's an OK button. 39 00:02:54,560 --> 00:02:59,460 Let's switch to the tax mode on close this let's create a first menu item. 40 00:02:59,580 --> 00:03:02,330 Droid a title do go out. 41 00:03:02,340 --> 00:03:03,400 I didn't need a string. 42 00:03:03,420 --> 00:03:06,660 And for that need to define the string in the string start exam. 43 00:03:06,750 --> 00:03:08,100 So let's do that. 44 00:03:08,100 --> 00:03:11,810 So project resources values on string good example. 45 00:03:12,270 --> 00:03:13,830 Let's create two strings you. 46 00:03:14,190 --> 00:03:19,410 That's designed three menus and for three minutes we were eating three strings so let's define all those 47 00:03:19,410 --> 00:03:31,180 three string resources here so strings a SDR home let's call it home similarly let's create another 48 00:03:31,190 --> 00:03:35,510 so let's call it string about us. 49 00:03:35,510 --> 00:03:45,640 So about us let's add another and let's call it a star contact us. 50 00:03:46,270 --> 00:03:56,640 Contact us let's call it conduct us OK mustering resources already so. 51 00:03:56,640 --> 00:04:00,820 Going back to the menu for example let's use this free resources here. 52 00:04:01,080 --> 00:04:08,760 So SDR home that's provided with an idea so let's call it same menu. 53 00:04:08,860 --> 00:04:12,660 Who similarly that our other two. 54 00:04:13,740 --> 00:04:14,710 So I do. 55 00:04:15,630 --> 00:04:19,440 Let's go like the title let's call it about us. 56 00:04:19,440 --> 00:04:20,650 Let's go I have an idea. 57 00:04:21,510 --> 00:04:26,940 So menu about us similarly. 58 00:04:27,570 --> 00:04:31,770 That's another throughout the title. 59 00:04:32,570 --> 00:04:36,380 So SDR contact us Android and Ivy. 60 00:04:36,780 --> 00:04:39,300 So menu. 61 00:04:39,510 --> 00:04:43,610 Contact us OK. 62 00:04:43,700 --> 00:04:45,090 Three menu items already. 63 00:04:45,920 --> 00:04:47,750 That's all I can say for these as well. 64 00:04:47,910 --> 00:04:56,220 So we need some icons of sauces or some dry blue sauces so coming to project resources right click 65 00:04:59,560 --> 00:05:03,990 new on Richter asset. 66 00:05:04,420 --> 00:05:05,350 Let's click. 67 00:05:09,350 --> 00:05:09,990 I'm for. 68 00:05:09,990 --> 00:05:11,550 That search home. 69 00:05:11,910 --> 00:05:12,990 So this all looks good. 70 00:05:14,190 --> 00:05:16,390 Let's select this let's call it. 71 00:05:16,590 --> 00:05:17,050 I see. 72 00:05:17,050 --> 00:05:20,740 Home to the next button. 73 00:05:20,740 --> 00:05:22,060 And that's created. 74 00:05:22,680 --> 00:05:28,970 Similarly LEDs are icons for the do so new rector upset. 75 00:05:29,250 --> 00:05:30,320 Let's click here. 76 00:05:33,290 --> 00:05:38,250 For about us we can use this one see assignment one. 77 00:05:38,310 --> 00:05:38,820 OK. 78 00:05:41,240 --> 00:05:45,140 Let's hit the next button on let's click on the finish button. 79 00:05:45,640 --> 00:05:54,030 Let's another resource resource new Richter upset on the last one is conduct. 80 00:05:54,030 --> 00:05:59,000 So let's use an e-mail icon so e-mail. 81 00:05:59,760 --> 00:06:00,720 Let's use this one. 82 00:06:01,770 --> 00:06:03,630 OK let's just rename it. 83 00:06:03,630 --> 00:06:07,160 Do I see e-mail let's hit the next button. 84 00:06:07,180 --> 00:06:08,570 Finish button. 85 00:06:08,620 --> 00:06:11,960 Well we've got three rivals for our three menus so let's use them here. 86 00:06:13,480 --> 00:06:20,890 So I can say well I see home similarly for about us. 87 00:06:20,890 --> 00:06:23,500 So I can draw a bow I see. 88 00:06:23,500 --> 00:06:29,360 Assignment on similarly for this one so I can I see e-mail. 89 00:06:30,170 --> 00:06:36,690 Well many fighters ready so coming back to our example let's try the menu find a few. 90 00:06:36,790 --> 00:06:40,080 So which was what the menu. 91 00:06:41,560 --> 00:06:42,300 OK. 92 00:06:43,340 --> 00:06:46,710 Let's have a look at the preview. 93 00:06:46,840 --> 00:06:47,980 Let's bring it to you. 94 00:06:48,670 --> 00:06:52,950 So as you can see it's on the so let's bring it at the bottom. 95 00:06:53,040 --> 00:06:56,430 So let's go and mail gravity say welcome. 96 00:06:57,570 --> 00:06:58,740 So now it's in the bottom. 97 00:06:58,740 --> 00:07:00,090 Let's change the colors. 98 00:07:00,420 --> 00:07:02,290 So let it be set loose. 99 00:07:02,300 --> 00:07:17,130 So background color trying to draw let's change the color for icons and text so Bichon friend let's 100 00:07:17,130 --> 00:07:20,110 call it Android go to white. 101 00:07:20,670 --> 00:07:24,010 And similarly for text so I don't text color. 102 00:07:24,720 --> 00:07:26,840 Android color white. 103 00:07:27,340 --> 00:07:31,080 OK well look just at an idea. 104 00:07:31,110 --> 00:07:36,660 So say bottom nav menu. 105 00:07:37,450 --> 00:07:40,060 Let's run our obligation and have a look. 106 00:07:40,150 --> 00:07:42,590 Let's close this on one our obligation 107 00:07:45,970 --> 00:07:46,680 Oh sorry. 108 00:07:46,740 --> 00:07:56,280 We've got an error here so let's fix not we just miss those three dogs plus idea let's run the application 109 00:07:56,280 --> 00:07:56,730 again. 110 00:07:58,650 --> 00:08:01,180 Well applications are running so let's have a look. 111 00:08:02,700 --> 00:08:04,420 Roll up obligations Sure. 112 00:08:04,430 --> 00:08:07,880 Let's click on About Us Contact Us. 113 00:08:07,940 --> 00:08:08,610 Oh. 114 00:08:08,990 --> 00:08:13,270 So let's you know just some even on these flicks. 115 00:08:13,340 --> 00:08:19,160 So coming to our Java file let's create an instance of our bottom navigation menu. 116 00:08:19,370 --> 00:08:24,420 So private bottom navigation view. 117 00:08:24,720 --> 00:08:25,310 OK. 118 00:08:27,010 --> 00:08:28,080 Let's initialize it. 119 00:08:29,010 --> 00:08:31,570 Find Hubert Ida or the IDA. 120 00:08:31,660 --> 00:08:33,310 Or on another menu. 121 00:08:34,420 --> 00:08:38,600 Okay so what another menu set of navigation items select listener. 122 00:08:38,920 --> 00:08:42,950 So let's this okay. 123 00:08:42,950 --> 00:08:44,300 Again it's a menu item. 124 00:08:44,300 --> 00:08:51,460 So did you switch gates on the basis of ideas so switch item not yet item Heidi. 125 00:08:52,610 --> 00:08:52,980 OK. 126 00:08:53,010 --> 00:08:55,090 That's not a case of I.D.. 127 00:08:55,340 --> 00:08:59,850 If you're going to remember the ideas for a menu I'm going home about that and contact us. 128 00:08:59,960 --> 00:09:01,130 So let's use those. 129 00:09:01,450 --> 00:09:02,310 So menu. 130 00:09:02,420 --> 00:09:03,790 So let's. 131 00:09:03,790 --> 00:09:08,770 Generally dose you so does not make decks. 132 00:09:08,780 --> 00:09:11,970 Let's go I can take some inactivity on this. 133 00:09:12,020 --> 00:09:13,340 Let's go right a message. 134 00:09:13,580 --> 00:09:15,980 So clicked home. 135 00:09:16,400 --> 00:09:20,210 Let's throw out the duration of the short on let's call the show function. 136 00:09:20,820 --> 00:09:21,440 OK. 137 00:09:21,500 --> 00:09:23,370 Because this needs to be done a boolean. 138 00:09:23,420 --> 00:09:25,140 So let's just return true. 139 00:09:27,760 --> 00:09:29,250 Let's up another case. 140 00:09:29,300 --> 00:09:33,800 So ordered a menu about us. 141 00:09:33,800 --> 00:09:35,480 Let's generate a toast. 142 00:09:35,700 --> 00:09:37,420 Let's just the base a few. 143 00:09:38,290 --> 00:09:38,980 OK. 144 00:09:39,110 --> 00:09:45,090 Let's just change the message so plagued about us similarly. 145 00:09:45,090 --> 00:09:48,620 That's another case. 146 00:09:48,640 --> 00:09:53,850 So it bothered me so many who contact us OK. 147 00:09:53,870 --> 00:10:03,480 That's just seems the message so contact us and let's out a default case so default return false. 148 00:10:05,370 --> 00:10:05,840 OK. 149 00:10:06,510 --> 00:10:08,540 So let's run it up big issue again 150 00:10:11,700 --> 00:10:17,800 low or obligations running so let's have a look let's click on the whole button. 151 00:10:17,820 --> 00:10:19,910 So it's a like home. 152 00:10:19,920 --> 00:10:21,860 Let's click on Contact Us. 153 00:10:21,870 --> 00:10:23,880 It says contact us. 154 00:10:23,880 --> 00:10:25,760 Let's write about us. 155 00:10:25,800 --> 00:10:27,420 Says click about us. 156 00:10:28,080 --> 00:10:29,670 Well your own rendering. 157 00:10:29,730 --> 00:10:32,350 You can render anything a figment of you. 158 00:10:32,730 --> 00:10:38,550 That's all about navigation use if you have any doubts any queries feel free to drop a moment and then 159 00:10:38,550 --> 00:10:40,490 go through it again. 160 00:10:40,800 --> 00:10:41,310 Well like.