月度归档:2014年07月

Android隐藏标题栏/全屏设置

试了很多种方法,还是这种比较靠谱。

1:确认或修改AndroidManifest.xml的application内容为以下代码:

<application
android:allowBackup=”true”
android:icon=”@drawable/ic_launcher”
android:label=”@string/app_name”
android:theme=”@style/AppTheme” >

2:在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>
<item name=”android:windowContentOverlay”>@null</item>
<item name=”android:windowFullscreen”>?android:windowNoTitle</item>

<item name=”android:windowFrame”>@null</item> 

<item name=”android:windowBackground”>@null</item> 

<item name=”android:backgroundDimEnabled”>false</item>
</style>

</resources>

3:这样还不一定能保证全屏,特别是加图片和弹出层的时候,还需要去掉res/layout/activity_main.xml的代码

 

android:paddingBottom=”@dimen/activity_vertical_margin”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”

 

 

原创文章,转载请注明: 转载自蔡洁锐的blog

本文链接地址: Android隐藏标题栏/全屏设置