是否存在“溢出”? Android 3.0+ 的视图动作栏?

发布于 2024-11-16 09:51:16 字数 175 浏览 3 评论 0原文

我的 ActionBar 上有许多选项卡,我想找到一种方法来在平板电脑进入纵向模式时处理这些选项卡。目前,如果您有超过 3-4 个以及任何显示的菜单项,则更多选项卡将被切断且不可用。我想知道是否有办法让这些自动溢出到“更多”选项卡中。或者,如果有一种方法可以将物理选项卡和额外选项的下拉列表作为最后一个“选项卡”。有人遇到过这种情况吗?

I have a number of tabs on the ActionBar and I want to find a way to handle those when the tablet is put into portrait mode. Currently, if you have more than 3-4 and any showing menu items, any more tabs will be cut off and unavailable. I'm wondering if there's a way to have those overflow into a "more" tab automatically. Or, if there's a way to have physical tabs and a drop down list for extra options as the last "tab". Has anyone encountered this scenario yet?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沐歌 2024-11-23 09:51:16

如果我正在开发需要具有大量选项卡的用例的应用程序,我会执行以下操作之一:

  1. 覆盖 onConfigurationChanged 以检测何时处于纵向模式并隐藏选项卡上的文本,仅留下图标。使用 主题 您还可以调整选项卡的填充内容。
  2. 重写 onConfigurationChanged 来检测何时处于纵向模式并将导航切换为基于列表。这将为您提供更多操作项空间,同时仍显示用户当前所在的“选项卡”。
  3. 实现一个自定义导航视图,它以您想要的任何方式响应纵向(例如,水平滚动、仅显示带有文本的所选选项卡、仅显示带有溢出样式按钮的附加选项卡)。

I would do one of the following if I were developing the app that required a use case with a high count of tabs:

  1. Override onConfigurationChanged to detect when in portrait mode and hide the text on the tabs leaving only the icon. Using themes you can also adjust the padding of the tab contents.
  2. Override onConfigurationChanged to detect when in portrait mode and switch the navigation be list-based. This will provide you with more room for action items while still showing the current "tab" that the user is on.
  3. Implement a custom navigation view which responds to portrait in whatever manner you would like (e.g., scrolling horizontally, presenting only the selected tab with text, showing only the selected tab with an overflow-style button for the additional ones).
瑾兮 2024-11-23 09:51:16

来自 http://developer.android.com/sdk/android-4.0.html#操作栏

ActionBar 已更新以支持多种新行为。最重要的是,系统在较小的屏幕上运行时可以优雅地管理操作栏的大小和配置,以便在所有屏幕尺寸上提供最佳的用户体验。例如,当屏幕较窄时(例如当手机处于纵向方向时),操作栏的导航选项卡会显示在“堆叠栏”中,该栏出现在主操作栏的正下方。

From http://developer.android.com/sdk/android-4.0.html#ActionBar

The ActionBar has been updated to support several new behaviors. Most importantly, the system gracefully manages the action bar’s size and configuration when running on smaller screens in order to provide an optimal user experience on all screen sizes. For example, when the screen is narrow (such as when a handset is in portrait orientation), the action bar’s navigation tabs appear in a “stacked bar," which appears directly below the main action bar.

Yay!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文