Skip to content Skip to sidebar Skip to footer

Why Has Tablistener Been Deprecated?

In Android 5 (API level 21) the ActionBar.TabListener has been deprecated. Why? What are we supposed to use instead? Does this mean that action tabs as a UI element have been depre

Solution 1:

Look this example SlidingTabsBasics If you need more info - check Google I/O sources

Solution 2:

Several ActionBar-related classes have been deprecated in favor of Toolbar, which is a generalization of ActionBar. Some extra reading here.

Solution 3:

As of Android 5.0 a tab style layout is best created by using the newly introduced design library by google. The easiest way to implement it (and not having to rewrite everything) is by using TabLayout in conjunction with a ViewPager.

I was able to reuse most of my code and it took me approx. 30 minutes to go through everything until I had a working TabLayout displaying my existing fragments.

You can find a very good tutorial here: https://github.com/codepath/android_guides/wiki/Google-Play-Style-Tabs-using-TabLayout

If you want more info on the design library this is a pretty good summary imo: https://github.com/codepath/android_guides/wiki/Design-Support-Library

Post a Comment for "Why Has Tablistener Been Deprecated?"