2014-06-09 74 views
0

我有一个简单的相机应用程序,我在alertdialog中使用了一个surfaceview来显示取景器。我注意到如果我通过更改alertdialog的大小手动调整取景器的大小,那么surfaceChanged()回调不会在方向更改时触发。如果我评论setlayout行,它会触发很好。我是否缺少标志或配置设置?当对话框调整大小时,surfaceChanged回调不会触发

感谢任何输入。

代码:

mBuilder = new AlertDialog.Builder(mContext); 
mBuilder.setTitle("test dialog"); 
mAlertDialog = mBuilder.create(); 

mFrameLayout = new FrameLayout(mContext); 
mSurfaceView = new SurfaceView(mContext); 
mFrameLayout.addView(mSurfaceView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); 

mAlertDialog.setView(mFrameLayout, 0, 0, 0, 0); 

mSurfaceView.getHolder().addCallback(mSHcallCallback); 

mAlertDialog.show(); 

mAlertDialog.getWindow().setLayout(200, 600); 

这是活动类外定义

​​

回答

相关问题