10.3制作Android Splash啟動界面


共分三步:

1.制作.9.png圖片

 可以參考這個文章

 

2.修改項目文件,使用.9.png圖片

用筆記本打開項目文件,先找到在項目中設置的Splash文件名,並改成第一步制作的.9.png文件名。例如:

我們可以在項目設置頁找到Splash Image文件名,如下圖:

在上圖中,是我已經改后的結果,Splash Image都用了同一個文件960x720.9.png。

項目文件的擴展名為.dproj,用筆記本打開他,查找上圖中設置的文件名,改成你需求的,一共是4個文件名。

為什么直接修改項目文件呢?因為在上圖上不能直接設置,該死的Delphi IDE在這里會檢查圖片的尺寸是否合法,不合法的尺寸,不讓Save...

3.制作style.xml並發布該文件

styles.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android"> 
<style name="AppTheme" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowBackground">@drawable/splash_image</item>  
  <item name="android:windowNoTitle">true</item>  
  <item name="android:windowFullscreen">true</item>  
  <item name="android:windowContentOverlay">@null</item> 
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

</resources>

styles21.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android"> 
<style name="AppTheme" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowBackground">@drawable/splash_image</item>  
  <item name="android:windowNoTitle">true</item>  
  <item name="android:windowFullscreen">true</item>  
  <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">false</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

保存上面兩個xml文件,然后利用Deployment發布到對應的目錄中,如下圖:

發布后,設置原來兩個文件不再發布。如上圖。

styles.xml發布到res\values\

styles21.xml發布到res\values-v21\

參考以前轉貼的文章:Delphi XE10 Android Splash設備自適應和沉浸式狀態條


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM