Split action bar - overlapping icons when using android: showAsAction = "always"

My problem is the icon of a specific action item, and the menu overflow icon overlaps in the split action bar, as shown below.

screenshot

Menu Resource File I Use:

<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:icon="@android:drawable/ic_menu_search" android:showAsAction="ifRoom" android:title="a"/> <item android:icon="@android:drawable/ic_menu_search" android:showAsAction="ifRoom" android:title="b"/> <item android:icon="@android:drawable/ic_menu_search" android:showAsAction="ifRoom" android:title="c"/> <item android:icon="@android:drawable/ic_menu_search" android:showAsAction="ifRoom" android:title="d"/> <item android:icon="@android:drawable/ic_menu_search" android:showAsAction="ifRoom" android:title="e"/> <item android:icon="@android:drawable/ic_menu_search" android:showAsAction="always" android:title="f"/> <item android:id="@+id/menu_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/menu_settings"/> </menu> 

Remember that the android: showAsAction attribute of the sixth menu item is always . When I use the normal action bar, everything is fine.

So, is this behavior a bug of the Android platform? Is there a workaround?

+4
source share
1 answer

So, is this behavior an Android platform bug?

Presumably. You might want to find an Android issue tracker to see if there are reports there. If not, create a reproducible test case that demonstrates the problem on a Nexus emulator or device, and post a new problem there. If you are thinking about this, add a link to this problem as a comment on this answer.

Is there a workaround?

Replacing always with ifRoom for the sixth and subsequent elements of the action bar, at least for the -normal-port configurations, should work.

+4
source

Source: https://habr.com/ru/post/1437964/


All Articles