Android, how can I replace the deprecated tabhost?

I am going to create an application that is designed to use Tabhost , but as I know it is deprecated. So my question is, should I use Tabhost anyway or how to replace it ... using the buttons instead declared in each xml or any other sentences?

+7
source share
2 answers

"Deprecated" in Android means "we think there is a better solution that you should explore." Rarely "obsolete" means "it is unsuitable." TabHost , TabHost , works great on Android 4.0.

In doing so, I would recommend considering switching to tabs in the action bar using ActionBarSherlock to ensure backward compatibility with Android 2.1.

UPDATE

In addition, TabHost not out of date. TabActivity deprecated. You can still use TabHost , with views for your tabs. Or use:

  • ViewPager with tabbed indicator, e.g. PagerTabStrip
  • FragmentTabHost , for a TabHost that uses tab snippets

The action bar also has tab support, but this has been deprecated since the ā€œLā€ Developer Preview.

+11
source

According to the Android API level of 18th, ActionBarSherlock is not recommended instead, they introduced ActionBarCompat .. It is better to go with ActionBarCompat .

Thanks.

+3
source

Source: https://habr.com/ru/post/914030/


All Articles