Search code examples
pythonkivyiconssmartphone

How to remove white background on kivy app icon?


Kivy app icon is not filling the entire space designed for It.

I am not English fluent, but I will describe my problem as best as I can. I am using an icon with 480 x 320 of size and It works fine on the smartphone, but instead of occupying the entire space, the icon is being reduced to approximatelly 50% of the size. The rest is being occupied by a white background. How do I do to put the icon for occupying the entire space?

The only change I made in spec file related to the icon was: icon.filename = directory_name/icon_name.png


Solution

  • There are in fact two ways to add icons for kivy apps. The quick one that you used which is simple but does not allow resize of the icon and an adaptative one which works as follows.

    You have to edit the following lines of the buildozer.spec file instead :

    # (str) Adaptive icon of the application (used if Android API level is 26+ at runtime)
    icon.adaptive_foreground.filename = ./resources/ic_launcher.png
    icon.adaptive_background.filename = ./resources/ic_launcher_background.png
    

    The two images must be defined as explained on this page : https://developer.android.com/develop/ui/views/launch/icon_design_adaptive

    Both images should have the same size, I recommend using 512x512. The foreground should have content only in the center square of dimension 312x312 (with recommended dimension).