Items in ActionBarCompat are showed always in Over

2019-03-17 20:31发布

I'm using ActionBarCompat in my app, an I want to show one or two items in the action bar

I follwed the guide of google developers, but when I test it, the items are showed in the "Overflow" option (in Nexus 4) and if I tap on the menu button if there exist (ex. Galaxy S3)

What I've doing wrong?

SOLUTION FOUND

You can find it in a answer.

7条回答
三岁会撩人
2楼-- · 2019-03-17 21:08

I think you need to provide the icon for these actions so they can appear in the action bar.

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:shudy="http://schemas.android.com/apk/res-auto" >

<item
    android:id="@+id/action_register"
    android:showAsAction="always"
    android:icon="@drawable/some_icon"
    android:title="@string/login_menu_register" />
<item
    android:id="@+id/action_register2"
    android:showAsAction="always"
    android:icon="@drawable/some_icon2"
    android:title="miau" />

</menu>
查看更多
登录 后发表回答