带有操作栏和选项卡的 Android 布局 [英] Android layout with action bar and tabs

查看:24
本文介绍了带有操作栏和选项卡的 Android 布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Android 新手,需要您的建议.我想要一个带有操作栏的活动,我还需要选项卡(但不是操作栏中的选项卡)和操作栏中的下拉列表来导航.当我点击例如第一个tab,actionbar中的navigation list应该填数据,第二个tab时,navigation list应该填另一个数据,等等,tab改变的时候action item也应该改变.当我从操作栏中的导航列表中选择某些项目时,应该更新视图.我不知道怎么做.

I'm new to Android and I need your advice. I would like to have an activity with action bar, I need also tabs (but not tabs in actionbar) and drop down list in action bar to navigate. When I click on e.g. first tab, the navigation list in actionbar should be filled with data, when seconds tab, navigation list should be filled with another data, and etc., the action items should also be changed when the tab is changed. When I select some item from navigation list in actionbar then the view should be updated. I'm not sure how to make it.

我将 ActionBarSherlock 用于操作栏,并且我已经使用 TabHost 和 TabWidget 带有片段的选项卡,当我单击选项卡时,片段会更改,但这并不是我想要的,我不知道该怎么做下一个.你能帮帮我吗?

I use ActionBarSherlock for actionbar, and I have already tabs using TabHost and TabWidget with fragments, when I click on the tab, then fragment is changed, but this is not exactly what I want, and I have no idea what to do next. Could you help me?

这是一个屏幕:

当我点击 Tab 1 时,操作栏中的导航列表应该是 Tab1 List1、Tab1 List2 等,并且应该在第一次显示列表中的默认视图(例如第一个 Tab1 List1)或用户最后选择时显示从导航列表中查看.当我单击选项卡 2 时,列表应该是 Tab2 List1、Tab2 List2 等,并且应该显示例如Tab2 List2 视图.等等.所以每个tab都会调整actionbar.

When I click on the Tab 1, then the navigation list in actionbar should be Tab1 List1, Tab1 List2 etc. and should be shown first time the default view from the list (e.g. first Tab1 List1) or last selected by the user view from the navigation list. When I click on the tab 2, list should be Tab2 List1, Tab2 List2 etc. and should be shown e.g. Tab2 List2 view. etc. So every tab adjust the actionbar.

推荐答案

你有两个选择:

  1. 在操作栏中使用列表导航,并在内容视图的顶部放置一个 TabWidget.
  2. 在操作栏中使用标签导航并使用 Spinner
  3. 设置自定义视图
  1. Use list navigation in the action bar and place a TabWidget at the top of your content view.
  2. Use tab navigation in the action bar and set a custom view with a Spinner

注意不要让用户超负荷.通常两种类型的导航会让人感到困惑.

Be careful not to overload your users. Usually two types of navigation can be confusing.

这篇关于带有操作栏和选项卡的 Android 布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆