Just rebuilt my app using the Android 5 SDK and associated appcompat.
Seems to work fine but my app icon is no longer showing in top left hand corner. The icon to open nav drawer is there but no icon.
Any way to fix this?
Use the code below in onCreate:
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
I too noticed that the default projects created by Android Studio were missing the icon in the action bar. Here's how I fixed it.
Disclaimer: This solution will result in in the Material theme being dropped in favor of the older JellyBean/Kitkat styles.
First, change themes setting in styles.xml from this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
To this:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
Now change all your Activities to inherit from android.app.Activity instead of android.support.v7.app.ActionBarActivity. That is:
Change this:
import android.support.v7.app.ActionBarActivity;
public class MainActivity extends ActivityBarActivity {
To this:
import android.app.Activity;
public class MainActivity extends Activity {
The end of result of doing this is an app that has the Holo theme more commonly seen on Jelly Bean and Kitkat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With