Search code examples
androidandroid-layoutandroid-actionbar-compat

Get Logo to left in ActionBar


First I have to say that I know this isn't correct anymore to the Google Guidelines. But still I need to know it.

I'm trying to Add the Android Icon in my ActionBar. Logo are not displayed in Actionbar, using AppCompat

This gave my the answer. But my problem now is that the logo is in the middle of the ActionBar. I want it in the left.

Code:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="actionBarStyle">@style/MyActionBarLogo</item>
</style>

<style name="MyActionBarLogo" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="background">@color/background_material_dark</item>
    <item name="logo">@drawable/icon</item>
    <item name="displayOptions">useLogo|showHome</item>
</style>

Printscreen:

PrintScreen

Anyone an idea? I have the feeling it's something stupid...

EDIT: Added Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ap.brecht.myapplication" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Solution

  • Yeah I found the problem. It's really stupid!

    The size of the icon was much to big! After changing it to 48 * 48 it works!