Putting a regular Button
in the action bar will look pretty awful, IMHO.
In doing so, you can use android:actionLayout
on the <item>
element in your menu XML resource. This should point to the name of the layout XML resource. This resource will be overstated in the action bar. You can get widgets by calling getActionView()
on the MenuItem
object corresponding to this <item>
element.
Here is an example project demonstrating this. Here is the documentation for this technique.
source share