安卓导航栏
我已经进行了大量搜索,但似乎找不到任何对我有帮助的东西。我是 Android 编程新手(不过我确实了解 Java),并且我正在开发一个处理从服务器下载动态内容的应用程序。我想要一个底部导航栏,它在整个应用程序中始终存在。该导航栏由 5 个按钮组成,单击这些按钮将打开一个新活动。不过,我希望将活动加载到导航栏上方的内容区域中。
所以基本上我会有一个包含内容视图和导航控制器的布局。导航控制器永远不应该改变...内容视图应该在单击导航按钮时加载新的活动。有人有什么想法吗?谢谢。
I've done a great amount of searching and I can't seem to find anything that helps me. I'm new to Android programming (I do know Java though), and I am working on an app that deals with dynamic content being downloaded from a server. I would like to have a bottom navigation bar, that is persistent throughout the app. This nav bar will consist of 5 buttons, that when clicked will open a new activity. However I would like the activity to be loaded in the content area above the nav bar.
So basically I will have a layout that contains a content view and the nav controller. The nav controller should never change...the content view should load a new activity upon nav button click. Does anyone have any ideas? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须为导航栏创建一个通用布局,并将其包含在活动的每个布局中。使用 xml 中的“include”标签来执行此操作。请看看下面的讨论,它可能会对您有所帮助。
每个活动底部的常用按钮或选项卡
You will have to create a common layout for the navigation bar , and include it in every layout of the activity. use "include" tag in the xml to do this. please have a look at the discussion below, it may help you.
Common buttons or tabs at bottom for every activity
看看这个项目:http://code.google.com/p/androidtabs/
Have a look at this project: http://code.google.com/p/androidtabs/
您可能需要考虑查看 Fragments 因为 TabActivity 已被弃用。您需要在 SDK 中下载兼容包以便在预蜂窝设备上使用它。它应该能够完全按照你的意愿去做。
You might want to consider looking at Fragments since the TabActivity is deprecated. You would need to download a compatibility package in the SDK in order to use it on pre-honeycomb devices. It should be able to do exactly as you want.