Android how can i replace the deprecated tabhost?

前端 未结 3 767
我在风中等你
我在风中等你 2020-11-30 10:58

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 a

3条回答
  •  清歌不尽
    2020-11-30 11:05

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

    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.

    UPDATE

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

    • ViewPager with a tabbed indicator, like PagerTabStrip
    • FragmentTabHost, for a TabHost that uses fragments for tabs

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

提交回复
热议问题