I think you need to use a panel.
Look at this example:
B4XDialog from XUI Views library can show simple dialogs, template based dialogs and custom dialogs. The example projects demonstrate the various template dialogs: https://www.b4x.com/android/forum/threads/b4x-xui-views-cross-platform-views-and-dialogs.100836/ This example focuses on...
This change seemed to work.
Sub btnCustom_Click
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 40%y, 300dip, 150dip)
p.LoadLayout("CustomDialog")
'dialog.PutAtTop = True 'put the dialog at the top of the screen
Wait For (dialog.ShowCustom(p, "OK", "", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
dialog.Show(fieldFirstName.Text & " " & fieldLastName.Text, "OK", "", "")
End If
End Sub
Not sure if there is another/better way.