如何添加UI选项卡在这个新的ICS的世界? [英] How to add UI tabs in this new ICS world?

查看:145
本文介绍了如何添加UI选项卡在这个新的ICS的世界?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,以显示在应用程序选项卡。实际上,我从来没有使用过TabHost等面前,该文档显示,整个事情是一个烂摊子。 TabActivity一直pcated德$ P $。我不能轻易使用也无妨,因为我正在使用ActionBarSherlock所以我不能继承它。然后当然作为ICS的,我不使用TabHost无论如何,我会使用操作栏的选项卡。由于我的标签只是文本,并在本质上是简单的我看到三个选项:

  1. 在踢TabHost与ActionBarSherlock工作。它会看猪的丑陋的ICS的设备。
  2. 使用ActionBarSherlock和实施的标签,就可以呈现在Android上之前的V4版本在某些方面的动作条选项卡中的假设(我不知道,如果是的话,我不怀疑)
  3. 只要使用浏览为标签活动之间跳转

我倾向于最后一个选项,但会美联社preciate澄清。

解决方案
  

使用ActionBarSherlock和实施的标签,就可以呈现在Android上之前的V4版本在某些方面的动作条选项卡中的假设(我不知道,如果是的话,我不怀疑)

这样看来,ActionBarSherlock支持在所有的Andr​​oid API级别ActionBarSherlock本身的标签支持。

例如,他们演示,你可以在Android 2.3环境:

有关选项卡支持。pre-3.0的设备的常见问题解答会谈。

和为造型标签的主题化页面列出主题的属性。

谷歌集团有各种各样的讨论使用标签。

I've a requirement to show tabs in an app. I've actually never used TabHost etc before, and the docs suggest the whole thing is a mess. TabActivity has been deprecated. I can't easily use it anyway as I'm using ActionBarSherlock so I cannot inherit from it. Then of course as of ICS, I'd not use a TabHost anyway, I'd use tabs on the Action Bar. As my tabs are just text and are simple in nature I see three options:

  1. Kick TabHost into working with ActionBarSherlock. It'll look pig ugly on ICS devices.
  2. Use ActionBarSherlock and implement tabs, on the assumption it renders the ActionBar tabs in some way on versions of Android prior to v4 (I have no idea if it does, I suspect not)
  3. Just use Views as "tabs" to jump between activities

I'm leaning towards the last option, but would appreciate clarification.

解决方案

Use ActionBarSherlock and implement tabs, on the assumption it renders the ActionBar tabs in some way on versions of Android prior to v4 (I have no idea if it does, I suspect not)

It would appear that ActionBarSherlock supports tabs on all Android API levels that ActionBarSherlock itself supports.

For example, they demo it on an Android 2.3 environment:

And the FAQ talks about tab support "on pre-3.0 devices".

And the theming page lists theme attributes for styling tabs.

And the Google Group has all sorts of discussion on using tabs.

这篇关于如何添加UI选项卡在这个新的ICS的世界?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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