• Android实例-解决启动黑屏问题(XE8+小米2)


    结果:

    1.在启动时马上出现图片界面,但在出现程序界面前会有黑屏,大约有0.2秒左右。

    实现:

    1.建立2个文件:loading.png和styles.xml:

    ①其中loading.png是启动时替代黑屏的图片。

    ②styles.xml是对背景图片的定义,其内容为:

     1 <resources>
     2 
     3      <!--
     4         Base application theme, dependent on API level. This theme is replaced
     5          by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
     6      -->
     7  <style name="MyTheme.NoTitleBar.CustomBackground" parent="@android:Theme.Black">  
     8          <item name="android:windowBackground">@drawable/loading</item>  
     9          <item name="android:windowNoTitle">true</item>  
    10          <item name="android:windowFullscreen">true</item>  
    11          <item name="android:windowContentOverlay">@null</item>  
    12   </style> 
    13      
    14      <style name="AppBaseTheme" parent="android:Theme.Light">
    15          <!--
    16             Theme customizations available in newer API levels can go in
    17              res/values-vXX/styles.xml, while customizations related to
    18              backward-compatibility can go here.
    19          -->
    20      </style>
    21 
    22      <!-- Application theme. -->
    23      <style name="AppTheme" parent="AppBaseTheme">
    24          <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    25      </style>
    26 
    27  </resources>

    2.因为在 Java 下大小写是敏感的,在 styles.xml 定义中“loading ”的这个文件名一定要用小写。

    3.文件 styles.xml 和 loading.png 最好放在工程文件所在根目录下。反正不要放在根目录的外面,其下子文件夹倒是可以,文件夹用英文,只是建义,不想找麻烦最好用英文。

    4.将建立好的2个文件打包到安装文件中:

    ①Project  ->Deployment->Add Files->选择文件 styles.xml 和 loading.png。

    ②PlatForm属性都设置为Android。

    ③RemotePath属性:

    styles.xml 的RemotePath为 resvalues

    loading.png 的RemotePath为 resdrawable-port

    5.工程缺省配置文件 AndroidManifest.template.xml:

    ①Ctrl+F9编译工程文件,并生成相关配置文件,打开工程文件所在目录,就可以找到。

    ②记事本打开AndroidManifest.template.xml文件,查找以下文字:

    android:theme="%theme%"

    替换为以下文字,注意是替换,不是新增,然后关闭并保存。

    android:theme="@style/MyTheme.NoTitleBar.CustomBackground"。

    6. 重新编译。

  • 相关阅读:
    Fiddler抓包使用教程-会话图标
    Fiddler抓包使用教程-安装配置
    Fiddler抓包使用教程-扫盲篇
    Java web 开发填坑记 2 -如何正确的创建一个Java Web 项目
    Java Web 开发填坑记- 如何正确的下载 Eclipse
    Android 监听 WiFi 开关状态
    Android 获取系统语言(兼容7.0)
    Android 监听手机GPS打开状态
    Android Monkey的使用
    Android 开源库和项目 3
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/4780785.html
Copyright © 2020-2023  润新知