+ // Adjust the scroll position of the navigation drawer.
+ if (bottomAppBar && navigationDrawerFirstView) { // The bottom app bar is in use.
+ // Reset the navigation drawer first view flag.
+ navigationDrawerFirstView = false
+
+ // Get a handle for the navigation recycler view.
+ val navigationRecyclerView = navigationView.getChildAt(0) as RecyclerView
+
+ // Get the navigation linear layout manager.
+ val navigationLinearLayoutManager = navigationRecyclerView.layoutManager as LinearLayoutManager
+
+ // Scroll the navigation drawer to the bottom.
+ navigationLinearLayoutManager.scrollToPositionWithOffset(14, 0)
+ } else if (Build.VERSION.SDK_INT < 35 && navigationDrawerFirstView) { // The top app bar is in use and the API < 35 (which causes the drawer to scroll down for some reason).
+ // Reset the navigation drawer first view flag.
+ navigationDrawerFirstView = false
+
+ // Get a handle for the navigation recycler view.
+ val navigationRecyclerView = navigationView.getChildAt(0) as RecyclerView
+
+ // Get the navigation linear layout manager.
+ val navigationLinearLayoutManager = navigationRecyclerView.layoutManager as LinearLayoutManager
+
+ // Scroll the navigation drawer to the top. <
+ navigationLinearLayoutManager.scrollToPositionWithOffset(0, 0)
+ }
+