B4J Question B4J CLV Background

CR95

Active Member
Licensed User
In the B4J Test joined program, I build a form with a pane with a blue color and I add a CLV with a green background color. This is correct in the WYSIWYG IDE view.

But in the execution, the CLV background is white

Is it a bug or a misunderstanding ?
 

Attachments

  • Test.zip
    501.2 KB · Views: 9

LucaMs

Expert
Licensed User
Longtime User
Custom views, and CustomListView is a custom view, don't use all the properties you see in the Designer. In WYSIWYG, you see a green placeholder.

Your CustomListView is empty, but even if you added some items, you wouldn't see the inner panel (green) because it would be as tall as the sum of the item heights, no more.

TRY this, but manually setting the inner panel's height is absolutely not recommended.

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    #IF B4J
        CustomListView1.sv.As(ScrollPane).InnerNode.PrefHeight = 200dip
        CustomListView1.sv.As(ScrollPane).InnerNode.As(B4XView).Color = xui.Color_Green
    #End If
End Sub
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
?
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    #IF B4J
    CallSubDelayed3(Me,"SetScrollPaneBackgroundColor", CustomListView1, xui.Color_Green)
    #End If
    
    For i = 0 To 5
        CustomListView1.AddTextItem("Item " & i, i)
    Next
    

End Sub

#If B4j
Private Sub SetScrollPaneBackgroundColor(View As CustomListView, Color As Int)
    Dim SP As JavaObject = View.GetBase.GetView(0)
    Dim V As B4XView = SP
    V.Color = Color
    Dim V As B4XView = SP.RunMethod("lookup",Array(".viewport"))
    V.Color = Color
End Sub
#End If

1772032337157.png


or CSS
B4X:
.scroll-pane{
   -fx-background-color:transparent;
}
.scroll-pane .viewport {
       -fx-background-color: transparent;
}
 
Upvote 0
Top