日期:2014-05-17 浏览次数:20862 次
SurfaceView sView;
ISurfaceHolder surfaceHolder;
OnCreate里面:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
RequestWindowFeature(WindowFeatures.NoTitle);
Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
SetContentView(Resource.Layout.layoutCameraMain);
// Create your application here
////获取ip地址
ipname = this.Intent.GetStringExtra("ipname");
//获取屏幕分辨率
DisplayMetrics dm = new DisplayMetrics();
Display display = WindowManager.DefaultDisplay;
display.GetMetrics(dm);
//screenWidth = dm.WidthPixels;
//screenHeight = dm.HeightPixels;
screenWidth = display.Width;
screenHeight = display.Height;
sView = FindViewById<SurfaceView>(Resource.Id.sView);//获取界面中的surface
surfaceHolder = sView.Holder;//获得SurfaceView的SurfaceHolder;
ISurfaceHolderCallback ish = new SurfaceHolderCallBack(this);
surfaceHolder.AddCallback(ish);
// 设置该SurfaceView自己不维护缓冲
surfaceHolder.SetType(SurfaceType.PushBuffers);
}