How to add UI tabs in this new ICS world?

冷暖自知 提交于 2019-12-08 08:59:13

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8563351/how-to-add-ui-tabs-in-this-new-ics-world

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!