添加代码
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;
}
}
<activity
android:name="com.wztech.mobile.demo.MainActivity"
<span style="color:#ff0000;">android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"</span>
android:launchMode="singleTask"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>