1、首先,绘制直线的数据是从客户端传送过来的,接受后更新SvDraw
/*定义一个画矩形框的类*/
public class SvDraw extends SurfaceView implements SurfaceHolder.Callback{
SurfaceHolder sh;
private int mWidth;
private int mHeight;
public SvDraw(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
sh = getHolder();
sh.addCallback(this);
sh.setFormat(PixelFormat.TRANSPARENT);
setZOrderOnTop(true);
}
public void surfaceChanged(SurfaceHolder arg0, int arg1, int w, int h) {
// TODO Auto-generated method stub
mWidth = w;
mHeight = h;
}
public void surfaceCreated(SurfaceHolder arg0) {
// TODO Auto-generated method stub