Does the attached sample project (based in your code) in my previous post work ?
Dialog.LoadLayoutMultiple("Dialog1_Portrait", "Dialog1_Landscape", "Dialog1").ShowOk("title","done")
Great. I will test it tomorrow.It is because the height of your layout panel is too big. Just resize it to make it smaller. Btw, the current DialogView (version 1.3) has support for different layouts per orientation:
B4X:Dialog.LoadLayoutMultiple("Dialog1_Portrait", "Dialog1_Landscape", "Dialog1").ShowOk("title","done")
OK.@MaFu: There is an android design issue. After orientation change, your activity will be recreated so there will be an inconsistency with a dialog that was opened from a previous activity. So, I decided to silently dismiss the dialog on orientation change. Since you will save the app state, you can invoke your dialog open function after state restore.
Also, DialogView follows the functionality of the standard msgbox that will be dismissed as well on orientation change.
'Configure the dialog title
Dim TitleBackground As ColorDrawable : TitleBackground.Initialize(Colors.Gray, 0)
Dialog.Options.Title.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD_ITALIC), Colors.Blue, 25, Gravity.CENTER, TitleBackground, Colors.Red)
'Configure the message content
Dim MessageBackground As ColorDrawable : MessageBackground.Initialize(Colors.Magenta, 0)
Dialog.Options.Message.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD_ITALIC), Colors.Blue, 25, Gravity.CENTER, MessageBackground)
'Configure the dialog buttons
Dim ButtonBackground As StateListDrawable : ButtonBackground.Initialize
Dim ButtonBackgroundNormal As ColorDrawable : ButtonBackgroundNormal.Initialize(Colors.Yellow, 0)
Dim ButtonBackgroundPressed As ColorDrawable : ButtonBackgroundPressed.Initialize(Colors.Cyan, 0)
ButtonBackground.AddState(ButtonBackground.State_Pressed, ButtonBackgroundPressed)
ButtonBackground.AddCatchAllState(ButtonBackgroundNormal)
Dim ButtonStyle1, ButtonStyle2, ButtonStyle3 As DialogViewButtonStyle
ButtonStyle1.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_NORMAL), Colors.Blue, 14, Gravity.LEFT + Gravity.BOTTOM, ButtonBackground)
ButtonStyle2.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD), Colors.Red, 14, Gravity.LEFT + Gravity.Top, ButtonBackground)
ButtonStyle3.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD_ITALIC), Colors.Black, 24, Gravity.CENTER, ButtonBackground)
'Dialog.Options.Buttons.Default.Style = ButtonStyle1 <= apply the style to all buttons
Dialog.Options.Buttons.Positive.Style = ButtonStyle1
Dialog.Options.Buttons.Neutral.Style = ButtonStyle2
Dialog.Options.Buttons.Negative.Style = ButtonStyle3
'Or set the style in one line
'Dialog.Options.Buttons.Default.Style.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_NORMAL), Colors.Blue, 14, Gravity.LEFT + Gravity.BOTTOM, ButtonBackground)
'Show the dialog
Dialog.Msgbox("title", "this is a standard message dialog", "yes", "no", "cancel", LoadBitmap(File.DirAssets, "icon1.png"))