android live wallpapers parallax-scrolling effect

风格不统一 提交于 2019-12-02 11:22:28

Call WallpaperManager.setWallpaperOffsets to instruct the wallpaper to scroll.

Documentation

So this should center the wallpaper:

WallpaperManager.setWallpaperOffsets(getWindowToken(), 0.5f, 0f);

This should scroll it to the side:

WallpaperManager.setWallpaperOffsets(getWindowToken(), 0f, 0f);

This should scroll it to the other side:

WallpaperManager.setWallpaperOffsets(getWindowToken(), 1f, 0f);

If you're going to do this, you ought to ensure that you know that the wallpaper can actually be scrolled, or that the user has asked you to enable scrolling. Many devices are configured with wallpaper that is the same size as the screen and does not scroll.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!