zoukankan      html  css  js  c++  java
  • Android -- 使用主题配置文件,去掉程序启动界面的短暂黑屏

    关于黑屏                                                                              

    默认的情况下,程序启动时,会有一个黑屏的时期,原因是,首个activity会加载一些数据,比如初始化列表数据等.

    去除步骤                                                                              

    1./res/values/styles.xml 在 Theme 中,添加一个 android:windowBackgrounds 属性,设置需要的图片

    2.在 AndroidManifest.xml 中设置Theme到首个启动的Activity下。

    3.添加 /res/drawable-port/loading.png (若是横屏的启动画面,请放于 /res/drawable-land/loading.png )

    4.完成

    Code                                                                                   

    <style name="MyTheme.NoTitleBar.CustomBackground" parent="@android:Theme.Black">  
            <item name="android:windowBackground">@drawable/loading</item>  
            <item name="android:windowNoTitle">true</item>  
            <item name="android:windowFullscreen">true</item>  
            <item name="android:windowContentOverlay">@null</item>  
     </style>
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">         
               <activity android:label="@string/app_name" android:theme="@style/MyTheme.NoTitleBar.CustomBackground"  android:configchanges="keyboardHidden|navigation|orientation" android:name="com.test.ui.MainActivity" android:screenorientation="portrait">  
              <intent-filter>  
                           <action android:name="android.intent.action.MAIN">  
                                <category android:name="android.intent.category.LAUNCHER">   </category>
                          </action>
             </intent-filter>  
     </activity>  
    ...  
    ...
    </application>

    我是天王盖地虎的分割线                                                             

    参考:http://blog.csdn.net/kepoon/article/details/6759724

  • 相关阅读:
    Tomcat Manager用户配置详解
    自动更新Chromium
    如何方便快速在指定文件夹打开命令行
    让Chrome 接管邮件连接,收发邮件更方便了
    Chrome扩展程序的二次开发:把它改得更适合自己使用
    更改Photoshop 语言为英语(无需语言包)
    Chrome 控制台新玩法-console显示图片以及为文字加样式
    JavaScript—之对象参数的引用传递
    jQuery 绑定事件到动态创建的元素上
    JavaScript –类型之我晕
  • 原文地址:https://www.cnblogs.com/yydcdut/p/3943385.html
Copyright © 2011-2022 走看看