Kamal
Kamal

Reputation: 1415

Create a layout larger then screen

I want to create a layout (RelativeLayout) which is larger then Screen, Approx 3500*3500. It has childes on various position which also use touch events to change their position.

What i have done by now is, to decrease scale the layout to a level that user can see all the views.

What my question is, if layout is not scaled(it is in its actual size 3500*3500), how to scroll through the layout to see all the child views?

@Override
protected void dispatchDraw(Canvas canvas) {

    //Save the canvas to set the scaling factor returned from detector
    canvas.save(Canvas.MATRIX_SAVE_FLAG);

    canvas.scale(mScaleFactor, mScaleFactor,gx,gy);

    //canvas.translate(tx, ty);
    super.dispatchDraw(canvas);

    mClipBound = canvas.getClipBounds();

      canvas.restore();
}

I was wondering if i can use canvas.translate(x, y) in touch move? Please suggest?

Upvotes: 0

Views: 57

Answers (1)

FD_
FD_

Reputation: 12919

Android already comes with a view container that is dedicated to all that scrolling business: ScrollView.

Upvotes: 1

Related Questions