Search code examples
androidsizescreenlive-wallpaper

How to scale Live Wallpaper to screen size?


I have been working on creating a live wallpaper lately by placing a bitmap image on a canvas. I created the images to fit a screen size of 480x800. The problem is that when I load the live wallpaper onto a tablet or larger screen size it does not fill the whole screen, or scale at all.

I have tried using DisplayMetrics but I havent been able to get it to work within the life wallpaper class. Any ideas on how I can scale images to fit the screen size within a live wallpaper?

Thanks!


Solution

  • Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); 
    width = display.getWidth(); 
    height = display.getHeight();