I am developing a wallpaper application in Android and i am finding a right way to set scrollable wallpaper for my app. Now, my code can set wallpaper from bitmap but it was cropped to fit with one page and just stayed only on one page (i have 5 pages in home screen). That means the content in each page can scroll through the wallpaper but the wallpaper was not scroll.
I want to set a scrollable wallpaper. I tried some codes from internet but they did not help. Do you guys have any idea?
This is my code
WallpaperManager wm = WallpaperManager.getInstance(mActivity.getContext());
try {
wm.setBitmap(mCropImageView.getCroppedImage());
} catch (IOException e) {
e.printStackTrace();
}
Try this, it worked for me on api>11
//get screen height
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
screenHeight = size.y;
wallPaperBitmap= ... //your bitmap resource
//adjust the aspect ratio of the Image
//this is the main part
int width = wallPaperBitmap.getWidth();
width = (width * screenHeight) / wallPaperBitmap.getHeight();
//set the wallpaper
//this may not be the most efficent way but it worked for me
wallpaperManager.setBitmap(Bitmap.createScaledBitmap(wallPaperBitmap, width, height, true));