Android横竖屏总结 //设置为无标题栏 Java代码 requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE); //设置为全屏模式 Java代码 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //设置为横屏 Java代码 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Java代码 android:screenOrientation="landscape" //在配置文件中,设为横屏 android:screenOrientation="portrait" //在配置文件中,设为竖屏 android:screenOrientation="landscape" //在配置文件中,设为横屏 android:screenOrientation="portrait" //在配置文件中,设为竖屏 Java代码 或者在res目录下建立layout-land和layout-port目录,相应的layout文件不变,比如main.xml。layout-land是横屏的layout,layout-port是竖屏的layout,其他的不用管模拟器自动寻找该配置文件;