[英]How to change the title bar color in android app using Delphi
我正在使用 Delphi 10.1 Berlin 来开发 Android 移动应用程序。 我需要更改 Android 应用程序的标题栏颜色,在搜索互联网时我发现了一些示例链接: Android Material design implementation和Stack overflow Question 。 但是我还没有找到任何使用 Delphi 实现它的链接。 请帮助我进一步进行。
在./res 文件夹中部署styles.xml
此文件的内容示例:
<?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%"
检查这个http://blog.rzaripov.kz/2016/12/android-ios.html (俄语) https://github.com/rzaripov1990/FMX.StatusBar (演示项目)
样式文件
<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>
部署
- Remote Name = styles.xml
- Remote path = \res\values-v21\
您可以使用我在 github 中的代码更改系统栏颜色(状态栏或导航栏):
https://github.com/viniciusfbb/fmx_tutorials/tree/master/delphi_system_bars
额外:您甚至可以使用 VisibilityOverlapping 使其半透明,并在其后面放置一个图像。 所有示例都在存储库中。
SharedActivity.getWindow.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_FULLSCREEN);
适用于 10.3.3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.