Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 3.0 Action bar Search View

In 3.0 tablet gmail app, when I click on the search button(on the action bar), it moves to the right and takes the whole action bar. How can I do this? Only way I can think is that by hiding all the other custom action bar fields when the search button is clicked. Is there an easier way? Thanks.

like image 430
FHan Avatar asked Apr 07 '11 15:04

FHan


1 Answers

You have to add an Action View. You can control which elements of your action bar are automatically "hidden" when there is no place for them declaring android:showAsAction="ifRoom" in your menu layout and force the ones that you always want to display using android:showAsAction="always".

Check the action bar documentation for some samples.

like image 120
mgv Avatar answered Sep 27 '22 17:09

mgv