This is a sample project to showcase ActionViews. ActionViews are custom views you can use within the ActionBar.

This demo makes use of ActionBarCompat and thus you have to add ActionBarCompat as a project dependency.

This demo and some of the acompanying blog posts were originally written with ActionBarSherlock in mind. I have migrated the code to ActionBarCompat with the last commit. I recommend to use ActionBarCompat for all new projects and to consider migrating to ActionBarCompat for existing projects!

Note: You might have to clean your project to get rid of Lint warnings and errors.

Most important classes

For using the SearchView see together with the menu file menu_fragment_searchview.xml.

If you want to inline replace an ActionBar item refer to and the accompanying menu definition in menu_fragment_placeholder.xml.

To understand the preexpanded layout see together with the menu xml definition in menu_fragment_expandable.xml.

Finally if you're interested in expandable Action Items you should look at and the menu xml definition in menu_fragment_expandable.xml.


Example Image

Relevant Blogposts on Grokking Android

Migrating from ActionBarSherlock to ActionBarCompat

Adding ActionViews to Your ActionBar

Adding ActionBarSherlock to Your Project

Getting Started With Fragments and the Support Library

Warning: Generated codebase

Please note: I have created the core of this sample using a custom generator. I'm going to publish many samples when writing blog posts and want to keep my work for those as focused as possible. The generator helps me achieve this even if it means that some code might seem a bit odd. I always refer to the relevant classes at the beginning of this README file.

tl;dr: Do not copy without thinking - should go without saying, but it's better to mention it once more!

Developed by

Wolfram Rittmeyer - You can contact me via:


Thanks to all my readers and blog commenters. Your feedback helps me to stay on track and to go on with projects like this.

Special thanks also to the Android crowd on G+. You're an awesome crowd. I have gained many insights by reading posts there, by following links to blog posts or by discussions on G+!

This readme was created using Thanks for this service.


Copyright 2013 Wolfram Rittmeyer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.