我为我的应用程序设置屏幕方向的代码不起作用我的手机挂起?
Display display = getWindowManager().getDefaultDisplay();
float width = display.getWidth();
float height = display.getHeight();
if (width>height)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// then
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
编辑1:解决
and also can i prevent the content to reload on screen rotation?
编辑 2:
CAn i prevent activity to reload when call is recieved specially problem is with list view it just flushed.
请回答编辑2