去掉 你的 Android App 开启时的 黑色闪屏或白色闪屏

最近回顾自己对Android开发,发现自己的曾近的App好多地方做的都不尽如人意,准备将一些细碎的问题总结一下,深化改革嘛......也为自己有朝一日跳槽准备一下,作为三栖程序员我可能接触的比一般程序员多一些东西,希望能够好好利用吧,闲言少叙。

<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="android:Theme.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. -->
    </style>
    
<span style="color:#ff0000;">    <style name="WelcomeTheme" parent="android:Theme.Light">
        <item name="android:windowBackground">@drawable/welcome</item>  
        <item name="android:windowNoTitle">true</item>  
        <item name="android:windowFullscreen">true</item>  
        <item name="android:windowContentOverlay">@null</item>  
    </style></span>

</resources>
在app/res/values/styles.xml 添加一个独立的主题 WelcomeTheme,集成android:Theme.Light ,这段代码要手敲,挺奇怪的。

然后在AndroidManifest.xml,你第一启动的Activity添加你私有的主题即可


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.welcome"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault.Light" >
        <activity
            <span style="color:#ff0000;">android:theme="@style/WelcomeTheme"</span>
            android:name="com.example.welcome.Introduction"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.example.photoback2.MainActivity" android:label="@string/title_activity_introduction"></activity>
    </application>

</manifest>


这样讨厌的黑屏就消失了,至于为啥出现很平我也闹不清楚,有待考察。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值