Android全屏设置

1.代码方式(在setContentView调用之前):

requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);// 设置全屏

2.xml配置:

<application

        ...

        android:theme="@style/AppTheme.FullScreen"

        ... >

在style.xml中添加如下代码:

<style name="AppTheme" parent="AppBaseTheme">
    <item name="android:windowNoTitle">true</item>    <!--无标题-->
    <item name="android:windowFullscreen">true</item>   <!--全屏-->
    <item name="android:windowIsTranslucent">true</item>
</style>

猜你喜欢

转载自blog.csdn.net/gengkui9897/article/details/81266607
今日推荐