解决android启动app时出现短暂的黑屏或一个带title的界面

    首次打开app的时候,一般进入到加载页面。有时候我们的app在进入加载页面钱会出现短暂的黑屏或者看到一个带title的界面,虽然转瞬即逝,不过依然影响我们的感受,查阅资料后找到2种解决方案:

    一般情况下通过eclipse创建的app默认的application的theme是AppTheme:  android:theme="@style/AppTheme",如下所示:

   <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
   </application>
   这时候我们需要修改AppTheme的样式,<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;">打开@style/AppTheme后如下所示:</span>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;"></span><pre name="code" class="html">    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
    现在有2种修改方案:
    1.<pre>    <!-- 为 Theme 设置透明属性 -->
    <style name="AppTheme" parent="android:style/Theme.Black.NoTitleBar.Fullscreen">
        <item name="android:windowIsTranslucent">true</item>
    </style>
    2.
    <!-- 为 Theme 设置背景图 -->
    <style name="AppTheme" parent="android:style/Theme.Black.NoTitleBar.Fullscreen">
        <item name="android:windowBackground">@drawable/splash_bg</item>
    </style>
    我使用了第一种方案,有效。
    
    参考:http://www.it165.net/pro/html/201409/22998.html
 
 
  


    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值