Hi developers,
for my own colorpicker i need to create a colordrawable for an horizontal bar that shows the picked color as central color , the white color to left and black to right.
As you know the colordrawable uses only 2 colors so i made 2 panels one near the other: the panel to the left shows the picked color gradient to white and the right panel shows the picked color gradient to black (see images)
I would like to make only one panel to let the user choose the final color but i don't know how to do this.
Also a way to merge the 2 gradient into one bitmap/canvas will be good enought, so i'll load the bitmap into one panel.
You can have more than 2 colors in a GradientDrawable!
B4X:
Sub Globals
Private pnlTest As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlTest.Initialize("")
Activity.AddView(pnlTest, 20dip, 20dip, 256dip, 50dip)
Private gdb As GradientDrawable
Private GradColors(3) As Int = Array As Int(Colors.White, Colors.Red , Colors.Black)
gdb.Initialize("LEFT_RIGHT", GradColors)
pnlTest.Background= gdb
End Sub
You can have more than 2 colors in a GradientDrawable!
B4X:
Sub Globals
Private pnlTest As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlTest.Initialize("")
Activity.AddView(pnlTest, 20dip, 20dip, 256dip, 50dip)
Private gdb As GradientDrawable
Private GradColors(3) As Int = Array As Int(Colors.White, Colors. , Colors.Black)
gdb.Initialize("LEFT_RIGHT", GradColors)
pnlTest.Background= gdb
End Sub