1

I'm developing an alternative home application which fits on one screen. Currently I have one activity ,which has the height and width of the phone screen,in which I try to set default wallpaper as background.

I use this code to do this:

getWindow().setBackgroundDrawable(peekWallpaper());

The problem is that it stretch the wallpaper to make it fit in one screen, so my wallpaper becomes completely flattened.

I found a workaround to avoid this, I extends drawable class and overide the method setBounds in order to avoid the stretching. But by doing this, I only see the left top corner of my wallpaper. So I would like to center it.

How can I do that ? Am I on the right way to do it ?

I have seen some methods in WallpaperManager class to move wallpaper :

setWallpaperOffsetSteps(float xStep, float yStep) 

and

setWallpaperOffsets (IBinder windowToken, float xOffset, float yOffset)

But I don't find any sample of code on how to use IBinder parameters, can it be usefull on my case ?

Thx in advance.

hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
Ant
  • 85
  • 1
  • 6

0 Answers0