Android 如何替换已弃用的 tabhost? [英] Android how can i replace the deprecated tabhost?

查看:41
本文介绍了Android 如何替换已弃用的 tabhost?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将创建一个旨在使用 Tabhost 的应用程序,但据我所知,它已被弃用.所以我的问题是我应该使用 Tabhost 还是我如何替换它..通过使用按钮而不是在每个 xml 或任何其他建议中声明的按钮?

I'm going to create an application which is designed to use Tabhost, but as I know it's been deprecated. So my question is should I use Tabhost anyway or how can I replace it..by using buttons instead of them declared in every xml or any other suggestions?

推荐答案

已弃用"在 Android 中的意思是我们认为您应该调查一个更好的解决方案".弃用"很少意味着它无法使用".TabHost,AFAIK,在 Android 4.0 上运行良好.

"Deprecated" in Android means "we think there is a better solution that you should investigate". Rarely does "deprecated" mean "it is unusable". TabHost, AFAIK, works fine on Android 4.0.

话虽如此,我建议考虑切换到操作栏中的选项卡,使用 ActionBarSherlock 向后兼容Android 2.1.

That being said, I would recommend considering switching to tabs in the action bar, using ActionBarSherlock to give you backwards compatibility to Android 2.1.

更新

此外,TabHost 没有被弃用.TabActivity 已弃用.您仍然可以使用 TabHost,以及选项卡的视图.或者,使用:

Besides, TabHost is not deprecated. TabActivity is deprecated. You can still use TabHost, with views for your tabs. Or, use:

  • ViewPager 带有标签指示器,例如 PagerTabStrip
  • FragmentTabHost,对于使用标签片段的 TabHost
  • ViewPager with a tabbed indicator, like PagerTabStrip
  • FragmentTabHost, for a TabHost that uses fragments for tabs

操作栏也有选项卡支持,但从L"开发者预览版开始就被弃用了.

The action bar also has tab support, but that was deprecated starting with the "L" Developer Preview.

这篇关于Android 如何替换已弃用的 tabhost?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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