package Ġcn . tang hz 1 7 . bil idata Ċ Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . navigation . find Nav Controller Ċ import Ġandroidx . navigation . ui . AppBar Configuration Ċ import Ġandroidx . navigation . ui . Navigation UI Ċ import Ġcn . tang hz 1 7 . bil idata . databinding . Activity Main Binding Ċ import Ġcom . google . android . material . bottomnavigation . Bottom Navigation View Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠActivity Main Binding ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠActivity Main Binding . inflate ( layout Inflater ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( binding . root ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnav View : ĠBottom Navigation View Ġ= Ġbinding . nav View ĊĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġfind Nav Controller ( R . id . nav _ host _ main ) ĊĊĠĠĠĠĠĠĠ Ġval Ġapp Bar Configuration Ġ= ĠApp Bar Configuration . Builder ( nav View . menu ). build () ĊĠĠĠĠĠĠĠ ĠNavigation UI . setup ActionBar With Nav Controller ( this , nav Controller , Ġapp Bar Configuration ) ĊĠĠĠĠĠĠĠ ĠNavigation UI . setup With Nav Controller ( nav View , nav Controller ) ĊĊĠĠĠ Ġ} Ċ }