Sign in

UX Policies — Part 2

This is an article part of a series. For objectives, fundamentals, project structure, and articles summary, see Android::Simplified

  1. NavigationView items are defined as Menu<item..> within an XML resource. The android:id must be the same as the one used within a navigation-graph — in this way, when an item is selected, it will automatically signal the nav-controller to navigate to such destination
  2. BottomNavigationView and NavigationView may contain their own Menu XML resources, depending on how you want to organize your destinations
  3. Toolbars (either top or bottom) and Drawer can be synchronized to work together — for top-level android:id the Toolbar displays the 3-bar icon, while for non-top-level, a back-arrow icon
  4. The Navigation-Graph must be considered the source-of-truth for all your navigation requirements — this means, no more Fragment Transactions or custom solutions to create Fragments — the app must always use a destination to go over a “screen”
UI Components Relationships
  • Add your destinations into the Navigation-Graph
  • Add new entries into the Menu resources
Toolbar and Drawer
Bottom-Navigation-View
Toolbar, Drawer, and Bottom-Navigation-View
Bottom-App-Bar and Drawer
Bottom-App-Bar and Bottom-Sheet
UX Style Switcher
  • Each XML layout uses ViewBinding, allowing us to define extension-functions for each one — see Decoupling Binding
  • From FragmentSettings, users can change the UX style
  • FragmentTestArchitecture also allows to change the style, aside from other functionality we will describe on the next part
  • The animation shows how the overall structure changes while maintaining both, theFragment and the navigation state

Senior Android Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store