0
点赞
收藏
分享

微信扫一扫

Android实例-Delphi XE10 Android Splash设备自适应和沉浸式状态条(XE10.1+WIN10)

Mezereon 2022-02-15 阅读 237



实例:

1.Delphi中在建立Android工程;

2.再创建两个目录(values-v19和values-v21);

3.每个目录中放一个style.xml;

4.其中values-v19\style.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>

5.values-v21\style.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>

</resources>

6.delphi菜单Project->Deployment;

7.在Deployment窗口中点击"add files" 小图标,选中"values-v19\style.xml";

8.在Deployment窗口把"values-v19\style.xml"的"Remote Path"的名字改为"res\values-v19\";

9.在Deployment窗口中点击"add files" 小图标,选中"values-v21\style.xml";

10.在Deployment窗口把"values-v19\style.xml"的"Remote Path"的名字改为"res\values-v21\";

11.delphi菜单"Project->Options...->Application-Target:Debug configuration-android platform";

12.选项界面中的"Include splash image"打上对号;

13.426*320、470*320、640*480、960*720选择4个图片(友情提示:如果图片大小与选项不符,会报错"incorrect image of XXXXXXXX");

14.运行一下程序看效果。

参数解释:

1、<item name="android:windowBackground">@drawable/splash_image</item>

意思是窗口背景使用我们已经替换掉的.9图片,@drawable/splash_image指通过project——Deployment中几个Remote Name为splash_image.png的图片

2、<item name="android:windowTranslucentStatus">true</item>

这个参数设置为True就是状态栏透明

3、<item name="android:windowTranslucentNavigation">false</item>

导航栏透明,这里设置为false,你可以试试改为true看看效果。

另外的参数都可以看百度上的解释,很全面,这里就不一一说了。


举报

相关推荐

0 条评论