Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 245
Hong Avatar asked Jan 26 '26 00:01

Hong


2 Answers

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.

like image 138
Hong Avatar answered Jan 28 '26 16:01

Hong


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!

like image 26
dcanbatman Avatar answered Jan 28 '26 15:01

dcanbatman