Android - How to show App logo in action bar

Anamnisis picture Anamnisis · Oct 23, 2013 · Viewed 12.1k times · Source

The theme of my application is Light. Can I display app icon in action bar without changing app style from Theme.Light to Theme.Holo.Light.

style.xml

<style name="AppBaseTheme" parent="android:Theme.Light">

AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:logo="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

The styles of "EditText" and etc object more beautiful with Theme.Light, that why I don't want to change it. It is possible or I should write style for each object and change theme of application.

Answer

Jim109 picture Jim109 · Mar 6, 2015

This works for me with Theme.Light

android.support.v7.app.ActionBar menu = getSupportActionBar();
menu.setDisplayShowHomeEnabled(true);
menu.setLogo(R.drawable.ic_launcher);
menu.setDisplayUseLogoEnabled(true);