所有活动中的自定义操作栏和导航抽屉 [英] Custom action bar and navigation drawer in all activities
本文介绍了所有活动中的自定义操作栏和导航抽屉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
在android studio中:
活动层顶部有一个自定义操作栏。它有自定义设置选项,它显示导航抽屉。
我想在其他活动中使用它。我应该在每项活动中编写代码吗?
如何在所有活动中使用它?
我尝试过的方法:
所有活动中的自定义操作栏和导航抽屉
Hello,
In android studio:
There is a custom actionbar on top of an activity layer. It has the custom setting option and it shows navigation drawer.
I want it in other activities. Should I write codes in every activity?
How can I use it in all activities?
What I have tried:
Custom action bar and navigation drawer in all activities
推荐答案
两个选项:
1.有一个包含自定义操作栏和导航抽屉的主要活动,然后将其他视图包含为此主要活动的片段而不是单独的活动,创建导航抽屉| Android开发者 [ ^ ];或者
2.有一个包含自定义操作栏和导航抽屉的基本活动,并通过其他活动进行扩展, Android开发人员:Android:具有多项活动的导航抽屉。 [ ^ ]
Two options:
1. Have one main activity that contains the custom action bar and navigation drawer, then include other views as fragments to this main activity rather than as separate activities, Creating a Navigation Drawer | Android Developers[^] ; or
2. Have one base activity that contains the custom action bar and navigation drawer and extended by other activities, Android Developer: Android: Navigation Drawer with Multiple activities.[^]
这篇关于所有活动中的自定义操作栏和导航抽屉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文