Android 创建底部栏菜单
我希望在每个页面的应用程序中始终存在一个静态底部菜单栏。我已经设计了菜单栏,但我很困惑是否必须将菜单代码与每个布局 xml 集成,以使菜单在每个页面中可见,并在每个活动类中编写代码以在菜单单击时执行功能。或者,如果有任何其他方式,我可以创建一个位于每个页面的公共底部栏,并在单个活动类中编写菜单代码。
I want to have an static bottom menu bar exist through out the applications in every page visible at bottom all the time. I have designed the menu bar but i am confused whether i have to integrate the menu code with every layout xmls to make menu visible in every page and write the code in every activity class to perform functions on menu clicks. Or if there is any other way i can create a common bottom bar that lies with every page with writing the code of menu in a single activity class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我看来,最好的方法是创建一个底部栏 xml 文件,并将其包含在每个 Activity 的 xml 文件中
,其中底部栏 xml 文件名为 Bottom_bar.xml
这篇文章也可能对您有帮助
http://android-developers.blogspot.com/2009/02/android -layout-tricks-2-reusing-layouts.html
Well the best way in my opinion , is to create a bottom bar xml file , and include it in every Activity's xml file
where your bottom bar xml file name is bottom_bar.xml
This article also might help you
http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html
还有
include
路线:There is also the
include
route:您可能正在寻找一个带有 TabBar 的 Activity,其中选项卡位于顶部,按钮位于底部: Android:底部的选项卡
然后您可以使用与选项卡相对应的不同视图,而不是单独的活动。
What you are probably looking for is one Activity with a TabBar with tabs at the top and buttons at the bottom: Android: Tabs at the BOTTOM
Then you can use different Views that correspond to Tabs instead of separate Activities.