Why does adaptive-icon generated by Android Studio crop images so much to make unusable?
Asked Answered
P

2

10

I used Android Studio's Asset Studio to generate TV banners: enter image description here

Everything looks great in Asset Studio, but the generated adaptive-icon crops the image so much that it is unusable: enter image description here

Here is what it looks like on Android TV: enter image description here

Could anyone shed some light on how to remove the cropping?

Photocompose answered 12/3, 2021 at 3:9 Comment(2)
Did you find any solution?Finback
@MisterDev21 Sorry for the late response. See my answer: https://mcmap.net/q/1077735/-why-does-adaptive-icon-generated-by-android-studio-crop-images-so-much-to-make-unusablePhotocompose
P
12

Since no one has answered the question since it was posted 9 months ago, let me try to answer it with my own solution.

Android Studio's Asset Studio to generates several file one of which is ic_banner.xml under directory mipmap-anydpi-v26:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_banner_background"/>
    <foreground android:drawable="@mipmap/ic_banner_foreground"/>
</adaptive-icon>

It shows the cropped image. I have modified it as follows:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_banner_background"/>
    <foreground>
        <inset android:drawable="@mipmap/ic_banner_foreground"
            android:inset="12%"/>
    </foreground>
</adaptive-icon>

Now, the icon looks just like other TV app icons. I got the hint from this post.

Photocompose answered 29/12, 2021 at 20:51 Comment(2)
I've done as you did. It still crops my banner in home screen.Globuliferous
I hope you have fixed your problem @Globuliferous ! If you haven't check my answer :)Snifter
S
1

Well, after 3 years, we still have this problem.

I solved this issue by generating adaptive banner as usual and then i deleted ic_banner.xml in mipmap-anydpi-v26 folder. Thus i forced my tv app to use ic_banner.png in xhdpi folder which is generated by Asset Studio.

Voila! That fixed cropping issue both in home/favorites and apps list!

Snifter answered 2/5 at 0:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.