One of the UI guidelines which Google made use of in their Twitter application is the Titlebar UI element.
The premise of the titlebar (Actually called Actionbar by Google I think) is that it replaces the default titlebar with a bar that is standard across the whole application. It will always have the same buttons (refresh, search, tweet etc.) and is not context sensitive (never changes).
Some applications have started using this UI element, however some don’t do it quite how Google explained it. The Facebook one for example changes depending on what activity you are on. The button to create a new status message seems to appear and disappear on different activities almost at random. Even the search button doesn’t stay in the same place constantly.
I’ve tried with my upcoming Madlab application to keep to this UI guideline as much as possible. To help with this I’ve come up with a way to almost force me to do this. It involves extending the Activity class with one I’ve called TitlebarActivity. This extends the Activity class by adding a method called setupTitlebar. This is called in the onCreate of the Activity which implements it after the content view has been set (it needs to do this to get access to the views used in the titlebar). All that needs to be done then is to create a layout file for the titlebar and then include it in the layout of any activity which makes use of TitlebarActivity.
The code is fairly simple to read, however at the minute there’s a lot of stuff in TitlebarActivity which needs to be removed or replaced. The way the passing of states works isn’t right and is sometimes causing some problems.
You can view the code in the Google Code project I’ve setup for this application. When the project is closer to completion I’ll most likely modify the TitlebarActivty class so it can be used in other projects more easily.