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
You shouldn't have an icon in an API OS 5+ app. By default it is not displayed (and this is the preferred behavior). The Toolbar docs specifically state this:
"In modern Android UIs developers should lean more on a visually distinct color scheme for toolbars than on their application icon. The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer."
http://developer.android.com/reference/android/widget/Toolbar.html
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.
Use the code below in onCreate:
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
Make sure to extend ActionBarActivity rather than Activity. And add the following code:
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);