Unable to add action buttons to my action bar in android studio -
i closely following steps on website
https://developer.android.com/training/basics/actionbar/adding-buttons.html , @ stage of tutorial wants me copy , paste code add action search , action settings. however, when run application, action search doesn't want appear.
i have made sure include .png icon of action search, still won't show.
i have tried changing minimumsdk version in build.gradle 8 11 suggested website, didn't work either. however, if not mistaken, action bar present in app though since overflow there.
from wild guess, might code outdated since have noticed lot of things have changed since tutorial written. still clueless weird problem.
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_settings" android:orderincategory="1" app:showasaction="always" android:icon="@drawable/ic_action_settings" android:title="@string/action_settings"/> <item android:id="@+id/volume" android:orderincategory="2" android:title="volume" android:icon="@drawable/ic_action_volume_on" app:showasaction="always"/>
you need xmlns referencing res-auto , use have used in code. hope helps.
Comments
Post a Comment