当我将屏幕从纵向模式更改为横向模式时,然后自动从我的应用程序中出来。(与横向到纵向相同)任何人都可以告诉我解决方案。
这是我的定位代码,
if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
Toast.makeText(MyAlphabetsActivity.this, "ORIENTATION_PORTRAIT",
Toast.LENGTH_SHORT).show();
setContentView(R.layout.portrait_main);
System.out.println("int-----1--");
} else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
setContentView(R.layout.landscape_main);
Toast.makeText(MyAlphabetsActivity.this, "ORIENTATION_LANDSCAPE",
Toast.LENGTH_SHORT).show();
System.out.println("int-----2--");
}
当将纵向更改为横向控件时输入 else if() 并显示 Toast Massage 也.......