Android 13 Themed Icon cut off / doesnt fit in frame
Asked Answered
B

1

5

I'm trying to implement the new themed icons and I have the problem that my icon is always zoomed in by 2x and I cannot get it to fit the canvas.

Below you can see the normal icon on the left and the themed icon on the right.

comparison

ic_launcher

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
    <monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>

ic_launcher_monochrome

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">

        <!-- PATH DATA -->

</vector>

Why is the themed version zoomed in and how can I fix this?

Beaumont answered 1/5, 2022 at 14:53 Comment(0)
B
6

Found a solution, just put your path data into a group and scale it down like this:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">

    <group
        android:pivotX="12"
        android:pivotY="12"
        android:scaleX="0.6"
        android:scaleY="0.6">

        <!-- PATH DATA -->

    </group>

</vector>
Beaumont answered 18/5, 2022 at 20:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.