如何使用Delphi改变安卓应用的标题栏颜色

0 人关注

我正在使用Delphi 10.1 Berlin开发Android移动应用程序。我需要改变Android应用程序的标题栏颜色,在互联网上搜索时,我发现了一些样本链接。 安卓材料设计的实施 堆栈溢出问题 .但我没有找到任何使用Delphi实现这一功能的链接。请帮助我进一步开展工作。

android
delphi
firemonkey
delphi-10.1-berlin
delphi-10.2-tokyo
test12345
test12345
发布于 2017-05-01
4 个回答
zeus
zeus
发布于 2020-06-27
0 人赞同

Deploy the styles.xml in the ./res folder

该文件的内容示例。

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="AppTheme.EditTextStyle" parent="@android:style/Widget.Holo.Light.EditText">
    <item name="android:background">@null</item>
  </style>
  <style name="AppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar"> 
    <item name="android:editTextStyle">@style/AppTheme.EditTextStyle</item>
    <item name="android:colorPrimary">#ff2b2e38</item>
    <item name="android:colorAccent">#ff0288d1</item>
    <item name="android:windowBackground">@android:color/black</item>
    <!-- <item name="android:windowTranslucentStatus">true</item> -->
  </style>
</resources>

编辑androidmanifest后,在<application ..>标签中添加android:theme="@style/AppTheme",而不是android:theme="%theme%"

我试着把黑色改成绿色,但只出现默认的黑色。这对Delphi 10.1西雅图来说是否有效?
ZuBy
ZuBy
发布于 2020-06-27
0 人赞同

This will only work with the Include Splash Image option enabled

check this http://blog.rzaripov.kz/2016/12/android-ios.html (俄语) https://github.com/rzaripov1990/FMX.StatusBar (demo project)

styles.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="AppTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">false</item>
        <item name="android:windowBackground">@drawable/splash_image_def</item>
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>

deployment

- Remote Name = styles.xml
- Remote path = \res\values-v21\
    
在XML中,我们应该在哪里提到颜色?正如你提到的远程路径为 "res/values-v21/",我是否需要提到android的基本版本。
vfbb
vfbb
发布于 2020-06-27
0 人赞同

你可以用我在github上的代码改变系统条的颜色(状态条或导航条)。

https://github.com/viniciusfbb/fmx_tutorials/tree/master/delphi_system_bars