Search code examples
androidtabactivity

Cross Version Compatible Android Tabbed Layout


I'm looking to create a cross-version compatible android tabbed layout.

The problem I'm running into is when implementing Google's example of TabActivity, I get a depreciation notice. The app I'm writing needs to be compatible down to 2.1, and I'm not finding a clear cut way to make it compatible.

I am aware of the versioning by folder (/layout-v4, /layout-v14, etc) but if possible I want to avoid this.

Are fragments the answer here and if so, does the Android Compatibility Layer V4 become the key to solving this problem?


Solution

  • I'd suggest the best approach might be to use the excellent (and free) ActionBarSherlock, so you can add Android 3+ action bar (including tabs) to apps going all the way back to v2.x versions.

    I've used it on a few apps and it's pretty easy. I think it's the right approach to use the proper Action Bar interface across platform versions, and they include tabs and replace the whole TabActivity thing, which was pretty horrible anyway.

    http://actionbarsherlock.com/