首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android 荧幕设置

2012-07-31 
Android 屏幕设置From: http://www.blogjava.net/anymobile/articles/293138.html?修改Android项目的Andro

Android 屏幕设置

From: http://www.blogjava.net/anymobile/articles/293138.html

?

修改Android项目的AndroidManifest.xml设置:

1、控制屏幕方向(横屏/竖屏),默认自动切换,修改Activity的配置:

//竖屏

android:screenOrientation="portrait"
//横屏

android:screenOrientation="landscape"

2、不显示窗口标题(window title),最大化窗口,默认显示,修改Activity的配置:


android:theme="@style/Theme"
//res/values/styles.xml

<style name="Theme" parent="android:Theme">
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
</style>

3、不显示状态条(state bar),完全全屏(fullscreen),默认显示,修改程序:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);

4、获取屏幕的方向:横屏/竖屏。。。


if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
Log.i("info", "landscape");
}
else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
{
Log.i("info", "portrait");
}

热点排行