Since I’m running ICS on my Nexus S, I wanted to bring Simple Lister up to date with the latest and greatest. I also didn’t want to ruin any backwards compatibility.
Turns out this was easier than expected, AND the application is fully backwards compatible with Android 1.6 (Donut).
Holo Theme
To get the basic “holo” theme, all I had to do was update the ‘uses-sdk’ line in the androidManifest.xml to target a version from Honeycomb (11) or higher:
SDK line in androidManifest.xml
Bam, everything came along for the ride, the default dark holo theme, the action bar at top.
Action Bar icons
Now, since we had a shiny new action bar, I might as well move menu items to that. All I had to do was go into my appropriate menu.xml and add the following to the items I want in the menu bar
android:showAsAction='ifRoom|withText'
So, that will display the appropriate icon in the action bar (if there is room) and display the title with it (if there is room).
The one caveat with the change in our menu.xml, make sure you update your “Project Build Target” in the project properties to at least API 11 if you are using Eclipse.
Eclipse - Build Target properties
In Summary
I did 3 simple changes to make my app happy for ICS:
- Updated androidManifest.xml’s
<uses-sdk>
element to include android:targetSdkVersion="11"
(or higher)
- Updated menu.xml files to include
android:showAsAction='ifRoom|withText'
to display icons on the Action Bar
- Eclipse only: Updated Project Properties – Build Target to at least API 11
What’s next?
While this gives us the most basic of ICS (and I suppose Honeycomb) look/style and the Action Bar, there are still more changes I can make:
- Updating the icon in the Action Bar to return to the ‘home’ action
- Adding more icons to the Action Bar
- Updating the Action Bar title to display the note’s title, and not just “Simple Lister”
- Looking into how Gmail on ICS has an upper and lower action bar
- and I’m sure there’s more, which I’ll get into in later posts.