B4J Question css problem

tufanv

Expert
Licensed User
Longtime User
Hello

I have a scrollview which have panels and inside panels there are some labels. If i use the below code , this changes the background successfuly but also makes every label textcolor black inside every panel. Why is that and how can i avoid it ?

B4X:
    If listana.size>0 Then
        For i=0 To listana.Size-1
    If i=selectedrow Then
    CSSUtils.SetBackgroundColor(panelcoin(i),fx.Colors.RGB(255,233,218))
    Else
        If tekcift(i)="tek" Then
        CSSUtils.SetBackgroundColor(panelcoin(i),fx.Colors.RGB(250,250,250))
        Else
        CSSUtils.SetBackgroundColor(panelcoin(i),fx.Colors.RGB(255,255,255))
        End If
    End If
    Next
    Else
    End If

thanks
 

Cableguy

Expert
Licensed User
Longtime User
The text is black because its set to be default color, which , since the normal label background color is transparent, the default textcolor is black, so by setting the background color black, the text is not visible.
I can think of 2 options, either you use a css file and a dedicated pseudo-class in it, accessing it by the nodes id, or (re) set the labels font color after applying the background css styling.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
The text is black because its set to be default color, which , since the normal label background color is transparent, the default textcolor is black, so by setting the background color black, the text is not visible.
I can think of 2 options, either you use a css file and a dedicated pseudo-class in it, accessing it by the nodes id, or (re) set the labels font color after applying the background css styling.
Thanks for answer , i dont understand why setting a backgorund color to a panel changes all its child views textcolors.
One textcolor is set to orange other one is yellow of a lanel inside this panel, when changing the bg color of panel, why the textcolor of labels are changing.? Are you sure of this ?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
setting it directly after the change of panel doesn't work but if I put sleep(10) between the change of panel color and its childs' color it works. for the record :)
 
Upvote 0
Top