SharjeelNisar
SharjeelNisar

Reputation: 73

android: How to minimize width of action bar overflow menu

I have to design an action bar which has two action items and a center aligned title, with three action items in overflow menu. On Samsung Galaxy S3, I have implemented it, but on Nexus4, the overflow menu comes on top and pushes action items to left. I want either to completely remove overflow menu from top or to squeeze it to minimum width. Can anybody tell me how can I do that? Thanx in advance.

Upvotes: 2

Views: 3926

Answers (1)

SharjeelNisar
SharjeelNisar

Reputation: 73

I was able to fix this issue earlier, now am posting this answer so that it may help anyone else. To squeeze the overflow menu edit your theme like this.

 <style name="AppTheme" parent="AppBaseTheme">
   <item name="android:actionOverflowButtonStyle">@style/overFlowButtonStyle</item>
 </style>
 <style name="ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar"> 
  <item name="android:actionOverflowButtonStyle">@style/overFlowButtonStyle</item>
 </style>
 <style name="overFlowButtonStyle" parent="@android:Widget.ActionButton.Overflow">
  <item name="android:minWidth">5dip</item>
  <item name="android:maxWidth">5dip</item>
  <item name="android:padding">0dip</item>
  <item name="android:src">@drawable/overflow_menu</item>
  </style>

Upvotes: 5

Related Questions