6

With the blogpost yesterday regarding us getting a healthy dose of Fragments all the way back to 1.6, I was wondering, will the ActionBar APIs be included in this backport?

They appear to be somewhat linked together, from the API Docs at the least. However, I could see the Fragments being separate from the ActionBar, but not visa-versa.

Anybody have any news?

Thanks -- Selig

Programmer Bruce
  • 64,977
  • 7
  • 99
  • 97
Amanda
  • 213
  • 2
  • 9
  • I sure hope so, but in the event they don't this question provides some solid examples of how to implement an ActionBar in 2.X: http://stackoverflow.com/questions/2900509/android-action-bar-like-twitter-sample – Corey Sunwold Feb 05 '11 at 21:33
  • 1
    On a separate note, it will be possible to to use the ActionBar when running in 3.0, while remaining backwards compatible, by setting your `targetSdkVersion` appropriately. Action bar styling and theming can be done purely in XML and the `ActionBar` class methods can be invoked via reflection. – Roman Nurik Feb 08 '11 at 17:27
  • I have written an extension of the Android Compatibility Library which includes support for the action bar through a single API as well as a single theme. It supports Android 1.6 up through the current latest, 3.1. You can find more info at http://actionbarsherlock.com. – Jake Wharton Jun 16 '11 at 12:45

3 Answers3

9

ActionBarSherlock at https://github.com/JakeWharton/ActionBarSherlock is an Android library for implementing the action bar design pattern using the native ActionBar on 3.0+ and a third-party library on pre-3.0.

It uses one of the other ActionBar implementations on pre-3.0 devices, either:

GreenDroid at https://github.com/cyrilmottier/GreenDroid

or android-actionbar at https://github.com/johannilsson/android-actionbar

Intrications
  • 16,782
  • 9
  • 50
  • 50
6

No it won't be included in the fragments library. The ActionBar is not tied to fragments at all.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200
  • Ah, that is a shame. Any chance you guys would backport it, because it has a rather nice API, better than the ActionBar librarys I've seen so far. – Amanda Feb 05 '11 at 22:27
  • 2
    It is more challenging because it is more deeply tied into the framework -- I think making this available would require a fairly radical change to its current API. (For example the framework's Menu APIs were extended to support the action bar.) So in this case I think it probably makes more sense to create a new implementation, modeled after the one in Honeycomb. This is very different from the Fragment and Loader APIs, which were literally just a couple days to copy the entire HC implementation to a library that works on older platforms. – hackbod Feb 06 '11 at 00:05
  • Ah, what lead me to beleive that they were tied together is the docs for the ActionBar state that the tabs are used to switch between fragments. Thanks for the reply. :) – Amanda Feb 06 '11 at 19:43
3

No, it won't but here is official Android sample that will help you achieve ActionBar from 1.6 to 4.x

Taranfx
  • 10,361
  • 17
  • 77
  • 95