Since setNavigationMode has been deprecated in API level 21 what can I use instead of setNavigationMode to create tabs.Is there an alternative library which I can use.
Action bar navigation modes are deprecated in API level 21.
So, it is not just setNavigationMode
but other stuff related to Action Bar such as addTab()
, selectTab()
, too are deprecated.
Other possible Alternatives:
1. PagerTabStrip: This is part of Android support library, and It is intended to be used as a child view of a ViewPager widget in XML layout.
2.Toolbar: Added in API Level 21, is a new class android.widget.Toolbar
. As per Android docs, A Toolbar is a generalization of action bars for use within application layouts.
ToolBar is a view placed in your view hierarchy that provides a similar, but more focused, API to the action bar.
An application may choose to designate a Toolbar as the action bar for an Activity
using the setActionBar
() method.
It depends on your app design as to which one you may want to choose as vis-a-vis replacement.
Check THIS Link for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With