October 28, 2012

Animated TabHost with slide gesture in Android

So when I was writing my Recept Keeper application i used a TabHost thinking it would have easy access animations and gestures for sliding. Turned out I was wrong and if targeting Android 4 or higher I could have used a PageView/Flipper.

I did however write a custom OnTabChangeListener that which has animations and gestures baked into it. Hope you can find some use of it in your TabHost!

Usage (in your TabHost): setOnTabChangedListener(new AnimatedTabHostListener(context, this));