Posts

Showing posts with the label navigation

Exploring Android Navigation Architecture Component - MVVM - Kotlin

Image
Navigation Architecture Component is released as a part of JetPack and androidx package. Its aim is to simplify the implementation of Navigation in our Android App. It defines a set of principles to build an in-app navigation with consistent and predictable user experience. Its main concept is to use single-activity architecture. It also has support for both Activity and Fragment. Principle of Navigation: The following are the principles of Navigation. App should have fixed starting destination A stack is used to represent the navigation state of app The 'Up' button never exits the app Up and Back are equivalent within your app's task Deep linking to a destination or navigating to the same destination should yield the same stack You can find the detailed explanation, here . Components of Navigation: (i) Navigation Graph - It's nothing but a map/blueprint of our in-app navigation. It has a list of all fragments and activities. We can also ...

Bottom Navigation using design Library in Android - Kotlin

Image
Introduction: Let's implement BottomNavigationView in our layout using Design Support Library. First, we have to go through the factors like, when  and how to use that. When to use? As per Material Design specs, the following criteria is there: (a) Tabs (TabLayout) - Should be used when there are two navigations. (b) Bottom Navigation - Should be used when there are 3 to 5 navigations. (c) Navigation Drawer - Should be used when there are 6 or more navigations. Also to remember that, Viewpager shouldn't be used with BottomNavigationView. You can read the complete design specs, here . How to use? BottomNavigationView have to be added  at the bottom of the screen. Also, the following are some of the important attributes: app:itemBackground - to apply background color  app:itemTextColor - to apply the color for the text of BottomNavigation item. app:itemIconTint - to apply the color for the icon of BottomNavigation item. app...