Android学习笔记之全屏显示以及屏幕旋转

在onCreate函数中

requestWindowFeature(Window.FEATURE_NO_TITLE);    //设置为无标题栏

getWindow().SetFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);  //设置为全屏模式

 

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);  //设置为横屏

 

 

Android内置了加速感应器,可以让应用程序自动适应屏幕的模式,即可进行屏幕旋转。

在eclipse中双击AndroidManifest.xml,选择Application选项卡,选中Activity类,然后在右边找到“Screen orientation”选项,选择"sensor",最后保存即可。

也可以手动在AndroidManifest.xml中修改Activity代码:

<activity android:name=".Activity01"

              android:screenOrientation="sensor"  //增加这个属性

 

 

你可能感兴趣的:(Android学习笔记之全屏显示以及屏幕旋转)