Android Question B4XComboBox TextColor in Cross Platform App - Android

aminoacid

Active Member
Licensed User
Longtime User
I have created a Cross Platform Application using B4XPages and XUI which has a B4XComboBox. I can easily change the text color and background color of a B4XComboBox in the B4J app (in designer) and in the B4I app it can be changed but not directly. See:


However, I cannot find any way to change the TextColor of the B4XComboBox in the Android App. Changing it in designer has no effect at run time.

Any suggestions would be appreciated.
 

Mahares

Expert
Licensed User
Longtime User
Any suggestions would be appreciated
You can use CSBuilder to change the text color. See following thread:
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
You can use CSBuilder to change the text color. See following thread:

Nice! That worked. Thank you :)
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
One issue though, I can now set the text color fine:

Items.Add(cs.Initialize.Color(Colors.White).Append("Hello "& j).PopAll)

However when you pull down the list from the combobox, the background color is a light blue making it difficult to read the white text.
Can't figure out how to also change the background color to say "black". Setting it in designer only works for the initial item displayed in the box but not for the items displayed in the pull-down.

Thanks!

[edit]

I figured it out:

Items.Add(cs.Initialize.Color(Colors.White).BackgroundColor(Colors.Black).Append("Hello" & j).PopALL)

Only thing I don't like is that I get a "zebra stripe" effect in the pull-down - black bands with the white text and an empty white band between each one. I guess that's acceptable for now but it would be nice if the background color of the entire pulldown could be changed.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Only thing I don't like is that I get a "zebra stripe" effect in the pull-down
I know that at the moment your main concern in America is Florida's hurricane Ian, but here is a complete example. There is no 'zebra stripe' effect.:
B4X:
lstItems.Initialize
    Dim cs As CSBuilder
    lstItems.AddAll(Array As Object(cs.Initialize.Color(xui.Color_Red).Append("Dog").PopAll, _
    cs.Initialize.Color(xui.Color_Magenta).Append("Cat").PopAll, "Bird", "Camel", "Tiger", "Elephant", _
    cs.Initialize.Color(Colors.White).BackgroundColor(Colors.Black).Append("Hello aminoacid").PopALL))    
    B4XComboBox2.cmbBox.DropdownBackgroundColor =xui.Color_Black     
    B4XComboBox2.SetItems(lstItems)
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
I know that at the moment your main concern in America is Florida's hurricane Ian, but here is a complete example. There is no 'zebra stripe' effect.:
B4X:
lstItems.Initialize
    Dim cs As CSBuilder
    lstItems.AddAll(Array As Object(cs.Initialize.Color(xui.Color_Red).Append("Dog").PopAll, _
    cs.Initialize.Color(xui.Color_Magenta).Append("Cat").PopAll, "Bird", "Camel", "Tiger", "Elephant", _
    cs.Initialize.Color(Colors.White).BackgroundColor(Colors.Black).Append("Hello aminoacid").PopALL))  
    B4XComboBox2.cmbBox.DropdownBackgroundColor =xui.Color_Black   
    B4XComboBox2.SetItems(lstItems)

Thank you @Mahares I'll try it out. Actually I live in Orlando and right now there's nothing to do but wait for Ian to arrive (and leave), so it's a good chance to get caught up on my B4X programming skills.


[EDIT] - Works perfectly now! Thanks again!
 
Last edited:
Upvote 0
Top