Reputation: 53
I cannot get my action bar to work right at all. There's way too many crazy examples to run through, but I have encountered things like the action bar overflow bottom showing up halfway down the UI in 4.0.3 (I'm using android:uiOptions="splitActionBarWhenNarrow"), to clicking item A yet item B showing as the selecting item in OnOptionsItemSelected(MenuItem), or not showing them all.
Not trying to do anything crazy. I just want a refresh icon, info icon, share icon to show up and then 2 extra options to show up from clicking the dotted overflow icon. But I cannot get it to work consistently. I need to support 4.0+.
Here's what I have right now. I have slaughtered the menu xml while pulling my hair out, but maybe someone can shed some light on what I must be doing horribly wrong? This current xml causes the bottom split action bar to sit right in the middle for the 4.0.3 AVD:
<item android:id="@+id/action_refresh"
android:icon="@drawable/ic_action_refresh"
android:title="@string/action_refresh"
android:showAsAction="always" />
<item android:id="@+id/action_info"
android:icon="@drawable/ic_action_about"
android:title="@string/action_info"
android:showAsAction="always" />
<item
android:id="@+id/menu_item_share"
android:showAsAction="ifRoom"
android:title="@string/action_share"
android:actionProviderClass="android.widget.ShareActionProvider" />
<item
android:id="@+id/action_category"
android:showAsAction="never"
android:title="@string/action_category" />
<item
android:id="@+id/action_about"
android:showAsAction="never"
android:title="@string/action_about"/>
Upvotes: 1
Views: 131
Reputation: 53
Seems like the share action provider was cause of most the issues. Just using an icon with click handler that builds a share Intent instead. Similar issue:
Upvotes: 1