Android Question How to get values for Default Color?

Sandman

Expert
Licensed User
Longtime User
Hi,

I have a layout that uses the Default Color for background, and I'd like to re-use it somewhere else. To do that I need to get what the Default Color is, but I can't figure out how to do it.

I tried this:

B4X:
Dim test As ColorDrawable
test.Initialize(0, 0)
test = Activity.Background

And I thought I'd be able to get the background using test.Color, or something like that. Nope. (I also tried looking at LayoutValues, but that's also a dead end.)

I imagine I could get the API level from the OS and do an internal look-up in a pre-compiled list of colors and use that value, but that seems kind of weird - surely we can get the actual color somehow? (Not to mention that the user might have enabled an inverted look, which would make the internal list useless.)

I should also mention that I'm not defining any colors in the manifest, it's a complete standard look here.
 
Top