Nestor
Nestor

Reputation: 8384

How to animate tab change with support library Actionbar

I use ActionbarSherlock that uses a support Actionbar for API level prior 11. I found this code to animate 'normal' tab change but I don't know how I could reference tab views from the Actionbar. Is there a good way to animate ActionBar of tab change?

Upvotes: 2

Views: 364

Answers (2)

baskar
baskar

Reputation: 46

Call the animation functions setAnimation(outToLeftAnimation()); and setAnimation(inFromRight()); inside the onTabSelected() function, as per the tab position. Thank you. Hope it will help you.

Upvotes: 0

Mohamad Ghafourian
Mohamad Ghafourian

Reputation: 1081

The Link you posted is an old solution for your goal. Actually using TabHost for implementing tabs is deprecated. You have to use Actionbar tabs with viewpager. There's a built in animation in viewPager. There are several tutorial for implementing actionbar tabs with viewPager. My recommendation is to use support library not actionbar sherlock but here is a great tutorial.

http://www.androidbegin.com/tutorial/android-actionbarsherlock-viewpager-tabs-tutorial/

Upvotes: 1

Related Questions