随笔-1  评论-68  文章-98  trackbacks-0

修改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");
}

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/netpirate/archive/2009/05/26/4216306.aspx

posted on 2009-08-29 23:25 Xu Jianxiang 阅读(2938) 评论(0)  编辑  收藏 所属分类: Android

只有注册用户登录后才能发表评论。


网站导航: