Android Question CustomLayoutDialog vs B4XDialog

Greg Breinholt

Member
Licensed User
Longtime User
Thought I would replace my existing pop-up dialogs (which use the older CustomLayoutDialog) with the newer B4XDialog (fromthe XUI Views lib).
Conversion was easy and I load the same layout in both. But I did find some differences that make the new B4XDialog not as ideal.

1. The CustomlayoutDiallog goes screen top to bottom - which looks better. See the red marking in the image below highlighting where the B4XDialog does not cover and hence does not feel so 'native". Is there any way to make this go truly top to bottom?

2. When using the phone Back button, the CustomLayoutDialog closes just the pop-up (this is the right behaviour). With the B4XDialog, it executes the back action on the activity behind the dialog, so in my case, it closes the pop-up and closes the Settings page too (not the right behaviour!). Anyone know how to prevent this and have the Back action only close the Dialog?
Edited with answer:

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
  If KeyCode = KeyCodes.KEYCODE_BACK And Dialog.Close(XUI.DialogResponse_Cancel) Then Return True
   Return False
End Sub

3. Is it possible to have more control over the title text in the B4XDialog? (position from top, text alignment, etc.)
Maybe there is a way to left align but I missed it? ;-)
Edited with answer: I should remove the provided title and create the title with my layout ;-)

1644134297535.png
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
With the B4XDialog, it executes the back action on the activity behind the dialog, so in my case, it closes the pop-up and closes the Settings page too (not the right behaviour!). Anyone know how to prevent this and have the Back action only close the Dialog?

Is it possible to have more control over the title text in the B4XDialog? (position from top, text alignment, etc.)
Maybe there is a way to left align but I missed it? ;-)
Remove the title and create everything with your layout.
 
Upvote 0
Top