3

After upgrading my compileSdkVersion, targetSdkVersion and Google support libraries the icons on appbar got squeezed on height.

Then before the upgrade of the dependencies all the icons where in the correct aspect (Squared), but after the upgrade of my project dependencies all the inflated icons on the appbar got squeezed on height. Bellow follows the difference between the upgrade.

I also notice that the squeeze only happens if the inflated button is inflated from a Fragment.

Screenshots:

Before upgrade the search icon is OK

After upgrade the search icon is squeezed on height

The Android Studio version is AS3 Cannary 8.

The upgrade on Gradle...

  • Before upgrade (Icons with correct aspect)

app/build.gradle:

android {
    compileSdkVersion 25
    ...
    targetSdkVersion 25
    ....
}

ext.supportLibraryVersion = '25.4.0'
ext.playServicesLibraryVersion = '11.0.2'

dependencies {
    // Android Support
    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    implementation "com.android.support:design:$supportLibraryVersion"
    implementation "com.android.support:support-v4:$supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$supportLibraryVersion"
    implementation 'com.android.support:multidex:1.0.1'
    implementation "com.google.android.gms:play-services-gcm:$playServicesLibraryVersion"
    implementation "com.google.firebase:firebase-appindexing:$playServicesLibraryVersion"
}
  • After upgrade (Icons with wrong aspect)

app/build.gradle:

android {
    compileSdkVersion 26
    ...
    targetSdkVersion 26
    ....
}

ext.supportLibraryVersion = '26.0.0'
ext.playServicesLibraryVersion = '11.0.4'

dependencies {
    // Android Support
    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    implementation "com.android.support:design:$supportLibraryVersion"
    implementation "com.android.support:support-v4:$supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$supportLibraryVersion"
    implementation 'com.android.support:multidex:1.0.2'
    implementation "com.google.android.gms:play-services-gcm:$playServicesLibraryVersion"
    implementation "com.google.firebase:firebase-appindexing:$playServicesLibraryVersion"
}

The layout inflated on the appbar:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".activity.MainActivity">
    <item
        android:id="@+id/action_search"
        android:icon="@drawable/search"
        android:orderInCategory="125"
        android:title="@string/search"
        app:showAsAction="always" />
</menu>

The layout appbar that will be inflated:

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways">
    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

The code to inflate the view above:

public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);

        inflater.inflate(R.menu.search_menu, menu);
}

Any ideas about this issue? This is a bug or I miss something?

0 Answers0