简体   繁体   中英

How to add Action bar to main screen when using navcontroller?

I am creating a project in which i would like to have following phenomenon. The first activity can be launched from an intent. When it is launched it has a back button on action bar. There are further destinations from this activity which i have set up using navcontroller. I have set up actionbar with navcontroller. But it removes the back button from main screen. What should i do to achieve desired result?

Try to enable the back button on action bar in your main activity:

 supportActionBar?.setDisplayHomeAsUpEnabled(true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM