Android GLSurfaceView在屏幕旋转后绘图区域异常的解决办法

添加代码

public void onConfigurationChanged(Configuration newConfig) {
		super.onConfigurationChanged(newConfig);

		DisplayMetrics mDisplayMetrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);
		int W = mDisplayMetrics.widthPixels;
		int H = mDisplayMetrics.heightPixels;

		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
			imageSurfaceView.getLayoutParams().width = W;
			imageSurfaceView.getLayoutParams().height = H;

		}
		else{
			imageSurfaceView.getLayoutParams().width = W;
			imageSurfaceView.getLayoutParams().height = H;
		}
	}


android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"
            android:launchMode="singleTask"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
            
                
                
                
            
        



你可能感兴趣的:(OpenGL,android)