package Ġcom . example . material component sex ample s . top app bar Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġcom . example . material component sex ample s . R Ċ import Ġcom . example . material component sex ample s . databinding . Col lap sing toolbar layout 2 Activity Binding Ċ import Ġcom . w zc . coordinator layout . examples . List Fragment Ċ Ċ /** Ċ Ġ* Ġ@ author Ġw ang zh ich ao Ċ Ġ* Ġ@ date Ġ 2 0 2 0 / 8 / 9 Ċ Ġ*/ Ċ class ĠCol lap sing Toolbar Layout 2 Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠCol lap sing toolbar layout 2 Activity Binding ĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠCol lap sing toolbar layout 2 Activity Binding . inflate ( layout Inflater ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( binding . root ) ĊĠĠĠĠĠĠĠ Ġset Support ActionBar ( binding . toolbar ) ĊĠĠĠĠĠĠĠ Ġsupport ActionBar ?. set Display Home As Up Enabled ( true ) ĊĠĠĠĠĠĠĠ Ġbinding . toolbar . set Navigation OnClickListener Ġ{ Ġfinish () Ġ} ĊĠĠĠĠĠĠĠ Ġsetup Fragment () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Fragment () Ġ{ ĊĠĠĠĠĠĠĠ Ġsupport FragmentManager . beginTransaction () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add ( R . id . fl _ container , ĠList Fragment . newInstance (" Android ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. commit () ĊĠĠĠ Ġ} Ċ }