Hi All,
I wanted to create a Gradient on a panel, and then write text to it.
I found a couple of different bits of code here on the forums and from the beginners guide. But when I combine them it doesn't work.
This is the code I'm using, and I tried it on both my device (a Kindle Fire) and on the virtual device. In both tests I get the gradient but no text.
I don't get any errors, but I'm guessing I've broken some coding rule?
Or is the text appearing somewhere I can't see? Like under the panel?
What am I doing wrong?
Thanks.
I wanted to create a Gradient on a panel, and then write text to it.
I found a couple of different bits of code here on the forums and from the beginners guide. But when I combine them it doesn't work.
This is the code I'm using, and I tried it on both my device (a Kindle Fire) and on the virtual device. In both tests I get the gradient but no text.
I don't get any errors, but I'm guessing I've broken some coding rule?
Or is the text appearing somewhere I can't see? Like under the panel?
What am I doing wrong?
B4X:
Sub Globals
Dim pnlTest As Panel
Dim csvTest As Canvas
Dim gdwGradient As GradientDrawable
Dim Cols(2) As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlTest.Initialize("pnlTest")
Activity.AddView(pnlTest, 0, 0, 100%x, 100%y)
csvTest.Initialize(pnlTest)
Cols(0) = Colors.RGB(112,255,148)
Cols(1) = Colors.White
gdwGradient.Initialize("TOP_BOTTOM", Cols)
gdwGradient.CornerRadius = 10dip
pnlTest.Background = gdwGradient
csvTest.DrawText( "Test", 25dip, 25dip, Typeface.DEFAULT, 30, Colors.Blue, "LEFT")
End Sub
Thanks.