Dianne Hackborn of the Android framework team mentioned in a post that they hope to have a version of this GridLayout available in the Support Package so that you can statically link this into your applications for use on previous versions of Android.
Now, with the drop of the ICS sources, all the source code related to these two new widgets came immediately available. After a first look on the sources it turned out that there is not much ICS-specific code. So I created a sample project that includes the related sources from ICS and the two GridLayout samples from the Api Demos application. Both UIs of the screenshots below are created through an XML-instantiated GridLayout. The left one is running on an emulator running Cupcake (1.5). And the right one is running on an emulator running Ice Cream Sandwich (4.0).
So, at this is moment it is already possible to start porting your UIs to a GridLayout. The main difference with the ICS specification and implementation is that you need to:
- use a different XML namespace to use as prefix when specifying the attributes (columnCount, layout_columnSpan, layout_column, ...) related to the GridLayout
- specify the full class name of the widgets GridLayout and Space in your layouts