Skip to content

Show Icons On Actionbar Not In Overflow Android

Show icons in the Android action bar instead of the overflow menu#

These notes are for older AppCompat action bar projects. In a modern app, prefer Material components or Jetpack Compose navigation patterns.

Requirements#

  1. Use the AppCompat library and make the activity extend AppCompatActivity:

    java public class MainActivity extends AppCompatActivity { ... }

  2. Make sure the activity theme is from AppCompat in AndroidManifest.xml:

    xml <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"> </activity>

  3. Use app:showAsAction in your menu XML:

    ```xml

    <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" />
    

    ```