我是Android开发的新手。我在我的Android应用程序中实现了一个选项,用于在FULL SCREEN和Normal Screen之间切换。下面是我的代码。但我遇到了一个问题。当我将应用程序切换到全屏模式时,我活动上的所有滚动视图都会停止滚动。当我切换回正常屏幕时,所有Scroll Views都能正常工作。帮助我。
//Shared Preferences
SharedPreferences screenPreference = getSharedPreferences("MyAppSettings", MODE_PRIVATE);
int ScreenFlag = screenPreference.getInt("ScreenFlag", 0);
SharedPreferences.Editor editor = screenPreference.edit();
switch(ScreenFlag)
{
case 0: //set preference ScreenFlag, app running first time
case 2: //Full screen - OFF
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
editor.putInt("ScreenFlag", 2);
editor.commit();
break;
case 1: //Full screen - ONN
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
editor.putInt("ScreenFlag", 1);
editor.commit();
break;
default:
break;
}
setContentView(R.layout.activity_main);
//end - Shared Preferences