0

I am trying to set a wallpaper, When i view it in Portrait mode then it actually sets what i see, but when i switch to landscape mode a bit gets cropped.

When i view it in landscape mode and then switch to portrait my image shifts upwards leaving a black border of about 150px because i switched from landscape to portrait.

This is because the viewport of a phone being 1920x1920 instead of the actual used size of 1080x1920. Is it possible to set a different wallpaper for each view (either landscape or portrait) ? without using a live wallpaper.

the viewport size is being retrieved using mWallpaperManager.getDesiredMinimumWidth() and mWallpaperManager.getDesiredMinimumHeight() where mWallpaperManager is an instance of WallpaperManager.

Maxim
  • 3,836
  • 6
  • 42
  • 64
  • 2
    You can make different XML files for each layout. So you can basically just change the whole layout when you are in portrait or in landscape. Refer to this post on how to do it: http://stackoverflow.com/questions/4858026/android-alternate-layout-xml-for-landscape-mode – Bram Jan 06 '15 at 10:32
  • @BramDriesen That is for when you want to set it in a layoutfile. I'm trying to set it as a wallpaper – Maxim Jan 06 '15 at 10:33
  • there are listeners available to notify when orientation changes. And on orientation change change the wallpaper – Heisenberg Jan 06 '15 at 11:57
  • @Heisenberg not for the wallpaperManager – Maxim Jan 06 '15 at 14:43
  • @MaximGeerinck have you found the solution? – Rahul Goswami Dec 22 '20 at 13:49

0 Answers0