Can I programmatically set the wallpaper for scrolling?

I am writing an application that allows a user to set a phone wallpaper from a list of images. By default, it scrolls across multiple home screens. I want the wallpaper on the home screen to be a static, non-scrollable image.

What can I do programmatically to achieve this? Is it possible?

I am using wallpaperManager.setResource(...); for setting wallpaper.

I also tried wallpaperManager.setWallpaperOffsetSteps(0,0); but this did not solve my problem.

+4
source share
4 answers

This is controlled by the Launcher app. If you want wallpaper without scrolling, install the Launcher application, which does not scroll the wallpaper :)

+2
source

I executed this function:

 final WallpaperManager wpm = (WallpaperManager)getSystemService( Context.WALLPAPER_SERVICE); wpm.setWallpaperOffsetSteps(1, 1); wpm.suggestDesiredDimensions(SCREEN_WIDTH, SCREEN_HEIGHT); 
+8
source

If you want to put some effort into the solution, you can create live wallpapers that will display a static, user-selectable image. Then your wallpaper can override the offset changes if necessary. However, a lot of work to stop the scroll effect.

Alternatively, you can crop the image to the size of the screen before installing it on the wallpaper. This will stop scrolling but disrupt screen orientation changes.

0
source

Typically, the ImageWallpaper size is set twice as wide as the screen width, so when you scroll the house left or right, ImageWallpaper handles offsetchange events.

I have not tried this, but it might work, I think. You can try the following: [suggestDesiredDimensions]: http://developer.android.com/reference/android/app/WallpaperManager.html#suggestDesiredDimensions(int , int)

Set the dimensions as well as the width of the workspace.

0
source

All Articles