I cannot change dialog background

23 views
Skip to first unread message

Juraj Balaz

unread,
Aug 11, 2020, 5:34:36 AM8/11/20
to CodenameOne Discussions
Hi, there, 

I use Dialog.show to pops up the message, but I'm not able to change the 
dialog backgroud. On android it is still grey on iOS it changed correctly. 
I use Dialog, DialogBody classes.

Shai Almog

unread,
Aug 11, 2020, 10:01:51 PM8/11/20
to CodenameOne Discussions
Hi,
the dialog uses a border to style it. You need to override the border to set it to a different color.

Juraj Balaz

unread,
Aug 13, 2020, 6:45:32 AM8/13/20
to CodenameOne Discussions
Please what's the mentioned border uiid that have to be overriden? 

The second thing that I faced with is that on the older version of the android phones (Sony Xperia E4g) created style 
won't work. Does this have something with compatibility or screeen resolution? 

If it is screen resolution how can I create styles for different resolutions? 

Shai Almog

unread,
Aug 14, 2020, 12:13:19 AM8/14/20
to CodenameOne Discussions
The UIID would be Dialog.

The version of Android shouldn't matter for this and neither should resolution if style if used correctly. How did you style the dialog?

Juraj Balaz

unread,
Aug 14, 2020, 1:19:38 AM8/14/20
to CodenameOne Discussions
Thank you I found same uiid in your sources but it won't work look screenshots attached (dialog, dialog2. png)

The second mentioned problem is not connected with dialog. When the appliaction is installed
on Sonny Xperia the result is also attached (transakcie.png) and screenshot from samsung where it looks
ok (screenshot_....jpg). I'm not able to explain either fix this behavior.
dialog.png
dialog2.jpg
transakcie.png
Screenshot_20200814-071632.jpg

Shai Almog

unread,
Aug 15, 2020, 1:19:21 AM8/15/20
to CodenameOne Discussions
Also override DialogTitle and possibly something else. In the simulator open the ComponentInspector tool and go over the hierarchy of the components until you find the applicable components. Then you can see the UIID of these components and you can change their styling dynamically to see the UI update live.

It looks like you defined regular images or sizes in percentages/pixels instead of millimeters for some of the elements. So you end up with UIs that look good on a high DPI device but look bad on a lower DPI device. You'll need to go over every element and check that backgrounds etc. are multi-images and that sizes are expressed in millimeters wherever possible.
Reply all
Reply to author
Forward
0 new messages