0

I'm trying to make a swipe views with tabs, and I found a lot of examples that works, but, I would like to work with actual elements and not deprecated like:

  • actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS)

  • actionBar.setSelectedNavigationItem(position);

  • actionBar.addTab(...)

Marlaurita
  • 583
  • 3
  • 11
  • 26
  • There are [many libraries for working with `ViewPager`](http://android-arsenal.com/tag/111), including many implementations of tabs. – CommonsWare Sep 02 '15 at 19:46
  • have you checked out this tutorial: https://androidbeasts.wordpress.com/2015/08/11/tabs-with-swipe-views/ – Aakash Sep 02 '15 at 19:47
  • @Aakash this tutorial could help, but if the minimumSDK is 19 my app will be less util, thanks anyway – Marlaurita Sep 03 '15 at 17:04

1 Answers1

2

If switch to the android support library is an option for you then you can use the new TabLayout.

See an example implementation here: http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/

If his is not an option you can take a look at the android developer sample called 'SlidingTabsBasic' which provides a tab control.

https://developer.android.com/samples/SlidingTabsBasic/index.html

Andre Classen
  • 3,868
  • 3
  • 26
  • 36
  • First link was perfect to me because Main activity extends from App Compact Activity, but it has things that i don't understand. Nevertheless, the second one is native and simple, Thank you!. – Marlaurita Sep 03 '15 at 16:54
  • Sorry, the blog in the first link does more then only add the tabbar. So maybe this answer is what you are looking for : http://stackoverflow.com/questions/30539772/android-tablayout-android-design If you still interested. – Andre Classen Sep 03 '15 at 20:08