i'm trying to draw an image as a background in live wallpaper app, but i don't know how to make it scrolls according to user tap to right/left (just like you set a simple wallpaper, if you move the menu to Rightmost, the background also move to Rightmost), here is the code in a live wallpaper app:
private void drawFrame() {
SurfaceHolder holder=getSurfaceHolder();
Canvas c=holder.lockCanvas();
c.drawBitmap(bg, 0, 0, paint);
holder.unlockCanvasAndPost(c);
handler.removeCallbacks(drawThread);
if (visible) handler.postDelayed(drawThread,100);
}
The above code only draw the background to a canvas, but i want to make it as same as simple wallpaper. For example, a very wide picture, how come it only shows the part that fits on "current" screen. I see other live wallpaper where the picture scrolls as you move to a different workspace left or right...is that an easy option or any other example i can follow?