How to Implement Android tab menu without deprecated tabhost

痞子三分冷 提交于 2019-12-05 13:26:24
ganero

CMIIW but i think tabhost is not deprecated yet. even if it's deprecated, it doesn't mean that you can't use it, it just mean that there is better alternative. Go for Tabhost if you think you really want and comfort to use it.

for alternative way, you can take a look at this : alternative of tabactivity or this if you go for better understanding in using Tabhost how do i use tabhost.

alternative ways including: Use a ViewPager with a tabbed indicator, such as PagerTabStrip, the TabPagerIndicator from the ViewPagerIndicator project, PagerSlidingTabStrip, etc.

Use tabs in the action bar (note: these will convert into a drop-down list in some device sizes and orientations)

Use FragmentTabHost

Use TabHost and TabWidget in a regular Activity

The following sample projects demonstrate:

PagerTabStrip: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/TabPager

TabPageIndicator: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/VPI

action bar tabs: https://github.com/commonsguy/cw-omnibus/tree/master/ActionBar/TabFragmentDemo

TabHost and TabWidget: https://github.com/commonsguy/cw-omnibus/tree/master/WidgetCatalog/Tab

Note that the first three samples all use ActionBarSherlock, so they run on Android 2.x devices. The fourth one should run on anything from Android 1.0 onwards.

You can use:

Action Bar in android

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