首页 > 移动平台 > 详细

android studio IDE 下,设置ACTIVITY全屏

时间:2016-01-06 14:10:39      阅读:286      评论:0      收藏:0      [点我收藏+]

因为ANDROID STUDIO的JAVA类是继承AppCompatActivity的 ,所以常规的全屏设置并不管用。如果要设置全屏,请参照如下代码/

1/首先,打开AndroidManifest.xml文件添加代码“android:theme="@style/AppTheme"”这个属性,这个APPTHRME是自定义属性,其整个XML代码如下

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="entss.ent.core.apps.unisi.com.myapplication">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MainActivity"></activity>
    </application>

</manifest>

2/设置STYLE属性

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- #region /设置全屏属性-->
        <item name="android:windowFullscreen">true</item>
        <!--#endregion -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
</resources>

 

 

OK,如上配置后运行APPS就可以看到全屏了。

android studio IDE 下,设置ACTIVITY全屏

原文:http://www.cnblogs.com/fan-yuan/p/5105190.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!