2

I can set Android's ActionBar background color easily via this code on colors.xml

<resources> 
    <color name="colorPrimary">#ffffc003</color>
    <color name="colorPrimaryDark">#ffffffff</color>
    <color name="colorAccent">#ff009486</color>
</resources>

I figured I could set the text to black adding this part:

<color name="textColorPrimary">#ff000000</color> 

But it has no effect, so the background is white and the text is also white.

BTW it would be nice to allow programatically change these values, so different forms could style their own action bars.

[EDIT] The first image has android.statusbar_hidden=true. The second, use colors.txt with colorPrimaryDark as white. And the third is the result I would like to have: a status bar with white background and black foreground.

android.statusbar_hidden=true colors.txt set to white enter image description here

Carlos Verdier
  • 245
  • 2
  • 10

1 Answers1

0

This will only impact the color of the status bar on top but it won't have any impact if you set the status bar to transparent.

It won't impact the action bar itself which is now drawn 100% by Codename One. I would suggest setting the status bar to transparent which will be more consistent with the way iOS handles this: how can color of status bar be changed as per different forms in codenameone?

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Sorry, but it's not clear to me how I can achieve that. Should I create a styles.xml file under native/android? Do I need to include a build hint with android.style as a key and android:fitsSystemWindows as value? Or should I download the sources and tweak something there? Please, as you can see I'm lost. A step by step explanation would be much appreciated. – Carlos Verdier May 09 '20 at 11:01
  • Sorry. I included an out of date link. The build hint is `android.statusbar_hidden=true` as explained here: https://www.codenameone.com/manual/advanced-topics.html – Shai Almog May 10 '20 at 03:16
  • Thanks, but not exactly the result I was expecting. I have updated my question. Is it possible something like that on Codename One? – Carlos Verdier May 10 '20 at 09:45
  • Try `android.hideStatusBar=true` it might be what I'm talking about. There's a bit of duplication of logic here. One should create this effect – Shai Almog May 11 '20 at 01:56
  • Yes, that hint hides the status bar. In forms where the background is dark, it's ok, but the problem remains to me, because the indicators colors are still white. Is there any way to make them black, as in the browser screenshot in my question? – Carlos Verdier May 11 '20 at 12:20
  • That might be a bug, Google should normally detect the colors and show a contrasting color for the status bar. Can you please file an issue with a test case. We'll look into it – Shai Almog May 12 '20 at 01:57