BarabulkaForever
BarabulkaForever

Reputation: 53

How can i add this icon to my action bar?

How can i add this icon to my action bar? Is it one of standard?

For example in this item.

    <item
    android:id="@+id/action_edit"
    android:orderInCategory="1"
    android:title="Ok"
    android:icon="@android:drawable/ic_menu_edit"
    android:visible="true"
    app:showAsAction="always" />

enter image description here

Upvotes: 2

Views: 674

Answers (1)

Nir Duan
Nir Duan

Reputation: 6392

You can do it via the theme xml layout by adding this to your style.xml file:

 <style name="MyTheme" parent="@style/Theme.AppCompat.Light">
   <item name="icon">@drawable/actionbar_logo</item>
  </style>

Or adding this programmatically inside your activity by adding this:

getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);

Upvotes: 1

Related Questions