how to zoom a view in android
I am trying to develop an application that displays lines of path of travel using openGL. I want to zoomin or zoomout the contents. Created a RelativeLayout and added the GLSurfaceView and ZoomCont开发者_开发问答rols to it. Now in the zoomControls.setOnZoomInClickListener i need to write how to zoom the view. For a view there are no zoom controls. Please help me if there is a way to zoom the view. Thank you..
mGLSView = new GLSurfaceView(this);
final RelativeLayout rl = new RelativeLayout(this);
ZoomControls zc = new ZoomControls(this);
zc.setOnZoomInClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
//// ??? WHAT TO DO WITH THE VIEW ?
}
});
zc.setVisibility(View.VISIBLE);
zc.bringToFront();
rl.addView(mGLSView);
rl.addView(zc);
setContentView(rl);
As far as I know, you cannot treat the GL Surface like a canvas and scale it. So you will have to redraw the scaled version again using GL calls. An alternative would be to draw into FBO and render the scaled texture to the surface.
精彩评论