Show Icons on ActionBar Not in Overflow Android
Show Icons in the ActionBar Instead of Overflow#
If you are using the view-based action bar or toolbar menu, set app:showAsAction on the menu item.
The activity should extend AppCompatActivity:
public class MainActivity extends AppCompatActivity {
}
Use the app namespace in the menu XML:
<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:title="@string/action_settings"
android:icon="@drawable/ic_settings_white_24dp"
app:showAsAction="ifRoom"/>
<item android:id="@+id/action_profile"
android:title="@string/action_profile"
android:icon="@drawable/ic_account_circle_white_24dp"
app:showAsAction="ifRoom"/>
</menu>
Use always sparingly. ifRoom lets Android place the item in the action bar only when there is enough space.