You can cut the image into square tiles (e.g. 256x256 px).
You can subclass View and maintain the current offset from the center [0,0] in member variables.
In onDraw(Canvas) you have to draw tiles that are visible based on the current offset (it’s easy to calculate what should be visible since you know the current translation offset, the size of each tile and the screen size. Tiles like Bitmaps on Canvas .
Then handle onTouchEvent in your activity. You can handle MotionEvent.ACTION_MOVE , where you will only move fragments that are currently visible, and then MotionEvent.ACTION_UP you will do a real redraw and call the thread to retrieve new fragments (so you won’t have to do an expensive operation for each finger movement). Use the View invalidate() method to force it to redraw after panning.
Axarydax
source share