开发者

Is there an "overflow" view for the Android 3.0+ ActionBar?

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?


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).


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜