Android GLSurfaceView在屏幕旋转后绘图区域异常的解决办法
16lz
2021-01-23
添加代码
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" >
更多相关文章
- Android 滑动效果代码分享
- Android点击按钮实现全屏的代码
- Android开关机代码
- android 设置默认launcher 附上代码
- Android通过代码自动连接WiFi
- Android service: startService的代码实现
- 【代码】利用Android的Log 演示一个activity的生命周期