I've started using the ActionBar coming with the AppCompat library. But any action I add to this, shows up in the overflow menu. I'm pretty sure I've skipped something, but I don't know at all. Here's my menu file:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/connect_plus"
android:icon="@drawable/ic_google_plus"
android:title="Connect to Google+"
android:showAsAction="always"
android:titleCondensed="Connect to Google+">
</item>
</menu>
And any configuration in the onCreate
method from an activity extending from ActionBarActivity
:
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
Did I miss something?
Did I miss something?
Yes.
You need to use your own namespace:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/connect_plus"
android:icon="@drawable/ic_google_plus"
android:title="Connect to Google+"
yourapp:showAsAction="always"
android:titleCondensed="Connect to Google+">
</item>
</menu>
as is shown in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With