Android 设置全屏

参考: http://www.cnblogs.com/Jaylong/archive/2012/08/30/activity.html
   http://www.tuicool.com/articles/QzaAna
http://www.cnblogs.com/bluestorm/p/3682477.html

res/values/styles.xml
<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        <item name="android:windowNoTitle">true</item> <!-- 设置没有标题 -->
    </style>

</resources>
 编写代码设置
在onCreate()方法里面setContentView()之前添加
// Full Screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
    WindowManager.LayoutParams.FLAG_FULLSCREEN);

// No Titlebar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//4.0以上有虚拟按键的隐藏
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

 

posted on 2014-08-22 16:57  Love I Smile  阅读(157)  评论(0编辑  收藏  举报