0
votes

I'm using Delphi 10.1 Berlin for developing Android mobile application. And I need to change the tittle bar color of the Android app and while searching internet I have found some of the sample links: Android Material design implementation and Stack overflow Question. But I have not found any links to implement this using Delphi. Please help me to proceed further.

4

4 Answers

1
votes

Deploy the styles.xml in the ./res folder

Example of a content of this file :

<?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>

after edit the androidmanifest and in <application ..> tag add android:theme="@style/AppTheme" instead of android:theme="%theme%"

1
votes

This will only work with the Include Splash Image option enabled

check this http://blog.rzaripov.kz/2016/12/android-ios.html (Russian) 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\
0
votes

You can remove the system background color and add your controls below the system bar, to be the system bar background.

Source of the code to set the status bar and navigation bar background full transparent:

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

You can put one TRectangle to be the status bar background:

uses
  iPub.Android.SystemBars;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Fill.Kind := TBrushKind.Solid;
  Fill.Color := TAlphaColors.White;
  TAndroidSystemBars.SetSystemBarsBackground(TAlphaColors.Blue, TAlphaColors.White);

  Rectangle1.Fill.Color := TAlphaColors.Blue;
  Rectangle1.Align := TAlignLayout.MostTop;
  Rectangle1.Height := TAndroidSystemBars.GetStatusBarHeight;
end;
-1
votes
SharedActivity.getWindow.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_FULLSCREEN);

Works on 10.3.3