Dim sv As ScrollView = clv.sv
Dim gd(2) As Int
gd(0) = Colors.RGB(0, 95, 170)
gd(1) = Colors.RGB(0, 190, 255)
Dim gdContent As GradientDrawable
gdContent.Initialize("LEFT_RIGHT", gd)
sv.Background = gdContent
the clv background changed but the items inside the clv have a diffrent color any idea why ?
I think its better to use a timer in my case sense I will change the clv colors each 1 minute.
Also timer could be a good choice sense each time I put the application to background or open the keyboard the clv gradient background cleared and had to be re drawed.
@mangojack i have also tried to do the same method you have posted
like following
B4X:
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim itempnl As Panel
itempnl.Initialize("")
itempnl.LoadLayout("itemlayout")
Dim gd(2) As Int
gd(0) = Colors.White
gd(1) = Colors.Blue
Dim gdContent As GradientDrawable
gdContent.Initialize("LEFT_RIGHT", gd)
itempnl.Background = gdContent
Return itempnl
End Sub
i got this exception when ever i try to set background
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.res.ColorStateList.getDefaultColor()' on a null object reference
Dim itempnl As B4XView = XUI.CreatePanel("")
itempnl.SetLayoutAnimated(0, 0, 0, Width, Height)
2. xCLV expects the root panel color to be a solid color. Add another panel in the layout that is anchored to BOTH sides and then change its background.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.