HarshBarash

Untitled

Jul 25th, 2021
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.78 KB | None | 0 0
  1. class MainActivity : AppCompatActivity() {
  2.  
  3.     private lateinit var navController: NavController
  4.  
  5.     override fun onCreate(savedInstanceState: Bundle?) {
  6.         super.onCreate(savedInstanceState)
  7.         setContentView(R.layout.activity_main)
  8.  
  9.         val navHostFragment = supportFragmentManager.findFragmentById(
  10.             R.id.nav_host_container
  11.         ) as NavHostFragment
  12.         navController = navHostFragment.navController
  13.  
  14.         // Установка navigation view
  15.         val navigationRailView = findViewById<NavigationRailView>(R.id.navigation_rail)
  16.         navigationRailView.setupWithNavController(navController)
  17.  
  18.     }
  19.  
  20.  
  21. }
  22.  
  23. //предожение студии
  24.  
  25. private fun NavigationRailView.setupWithNavController(navController: NavController) {
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment