I am trying to make the wallpaper fit to screen. I tried many solutions on this site but none worked for me except this one, but the image doesn't cover the screen. It kind of shrinks and it can appear anywhere on the screen, mostly in the center. The image size changes again on next reboot. Eg it appears in the middle and is much smaller than the screen size but when I reboot my device, the image size exceeds the bounds of the screen
Below is my code:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
imageIDs[imageIDforWallPaper]);
int w = bitmap.getWidth();
int h = bitmap.getHeight();
WallpaperManager wm = (WallpaperManager) getSystemService(WALLPAPER_SERVICE);
try {
wm.setBitmap(bitmap);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wm.suggestDesiredDimensions(w, h);
What you are looking for is similar to a splash screen.
read also here: Android splash screen image sizes to fit all devices
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.