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?
preguntado el 01 de febrero de 12 a las 03:02
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); width = display.getWidth(); height = display.getHeight();
You need to scale your bitmap according to width and height of wallpaper. You can get width and height in onSurfaceChange() method. And yes dont forget to multiply your width with 2 to make parallax scrolling.
Try not to use the " size(); " command. Use " fullScreen(); " it will adapt your wallpaper to the screen size of whatever device it's running on.
You can also use " displayWidth " and " displayHeight " anywhere in your code to help.