You should check if any of the lines that make the edges of Rect1 intersect any of the lines that make the edges of Rect2. This is especially easy in the case of screen rectangles because all the lines are parallel to either the x or y axis.
(a lot of useful functions there) and converted the intersects code to B4A
B4X:
Public Sub Intersects(Field1 As Rect, Field2 As View) As Boolean
If Field1.Right > 0 And Field1.Bottom > 0 And Field2.Width > 0 And Field2.Height > 0 And _
Field1.Left < (Field2.Left + Field2.Width) And Field1.Right > Field2.Left And _
Field1.Top < (Field2.Top + Field2.Height) And Field1.Bottom > Field2.Top Then Return True
Return False
End Sub
Code to test below
B4X:
Dim RelativeY As Int = GetRelativeTop(FieldEntry.Field)
Dim RelativeX As Int = GetRelativeLeft(FieldEntry.Field)
Dim FieldRect As Rect
FieldRect.Initialize(RelativeX, RelativeY, (RelativeX + FieldEntry.Field.Width), (RelativeY + FieldEntry.Field.Height))
Log("Intersects: " &Intersects(FieldRect, sID_KB_Frame))
Because I am not using EditText fields. I am using Labels - do not like the way edittext fields look or work.
Also I do not believe this should be a field problem but rather a keyboard problem
Thanks for the help. The intersects code works just fine