[英]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.我使用 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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.