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#
-
Use the AppCompat library and make the activity extend
AppCompatActivity:java public class MainActivity extends AppCompatActivity { ... } -
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> -
Use
app:showAsActionin your menu XML:```xml
```