Greetings.
Please refer to CSSUtils thread by Erel.
I modified Erel's example using CSSUtils and also used a css file to obtain the results shown below. The code and the actual css file are also included. With the css file, I am able to set the background color and text color of a listview (without the use of a pane).
QUESTION
How can I accomplish what the css file does using Erel's CSSUtils?
Thank you in advance for your replies.
Sandy
css file:
Please refer to CSSUtils thread by Erel.
I modified Erel's example using CSSUtils and also used a css file to obtain the results shown below. The code and the actual css file are also included. With the css file, I am able to set the background color and text color of a listview (without the use of a pane).
QUESTION
How can I accomplish what the css file does using Erel's CSSUtils?
Thank you in advance for your replies.
Sandy
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Pane1 As Pane
Private ListView1 As ListView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
'@@@@@
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "LV.css"))
'@@@@@
CSSUtils.SetStyleProperty (Pane1, "-fx-background-color", "springgreen")
CSSUtils.SetStyleProperty (Pane1, "-fx-border-color", "red")
CSSUtils.SetStyleProperty (Pane1, "-fx-border-width", "10")
For i=1 To 20
ListView1.Items.Add("Item # "&i)
Next
End Sub
css file:
B4X:
.list-cell { -fx-background-color: black; /* 1 */ }
.list-cell { -fx-background-color: black; /* For information */ }
.list-cell { -fx-text-fill: white; /* 5 */ }
.list-cell:filled:hover {
-fx-background-color: cadetblue; /* 2 */
-fx-text-fill: white; /* 5 */
}