But when i use getviewscolor(panel1) , panel 1 goes white. Every view goes white when i use get color on it. Is it an outdated solution, can we have an updated sub to get a color's view. ?
It is indeed related to a change in the way views handle their background. I've fixed this issue in Canvas.DrawViewable code.
For now you can use this instead:
B4X:
Sub GetViewsColor(v As View) As Int
Dim jo As JavaObject = v.Background
Dim b As Rect = jo.RunMethod("copyBounds", Null)
Dim destRect As Rect
destRect.Initialize(0, 0, cvs.Bitmap.Width, cvs.Bitmap.Height)
cvs.DrawDrawable(v.Background, destRect)
jo.RunMethod("setBounds", Array(b))
Return cvs.Bitmap.GetPixel(5dip, 5dip)
End Sub
It is indeed related to a change in the way views handle their background. I've fixed this issue in Canvas.DrawViewable code.
For now you can use this instead:
B4X:
Sub GetViewsColor(v As View) As Int
Dim jo As JavaObject = v.Background
Dim b As Rect = jo.RunMethod("copyBounds", Null)
Dim destRect As Rect
destRect.Initialize(0, 0, cvs.Bitmap.Width, cvs.Bitmap.Height)
cvs.DrawDrawable(v.Background, destRect)
jo.RunMethod("setBounds", Array(b))
Return cvs.Bitmap.GetPixel(5dip, 5dip)
End Sub
I have got a problem with this. When I use
if getviewscolor(lbl1)= colors.transparent ıt makes problem. it does not recognize the color as transparent so i can't achieve what i want. Is there a fix for this
by thw way if i use getviewscolor(lbl1)=colors.green it is not working but if i use colors.rgb(..) it works. So i think it does not recognize when we write colors.green or colors.red , we have to put in rgb . But what can i write for rgb for transparent ?