Android Question CustomLayoutDialog without padding

ok, i just figure it out, no need to adjust the padding, just make the dialog color to transparent :D

from sample above link, i modify Activity_Click event to this:

Code: Copy
Sub Activity_Click
   Dim cd As CustomLayoutDialog
   Dim cdlg As Object = cd.ShowAsync("Choose item", "", "", "", Null, False)
   cd.SetSize(100%x, 100%y)

   Dim jo As JavaObject = cdlg
   Dim warna As ColorDrawable
   warna.Initialize(Colors.Transparent,0)
   jo.RunMethodJO("getWindow",Null).RunMethod("setBackgroundDrawable", Array(warna))

   Wait For Dialog_Ready (DialogPanel As Panel)
   DialogPanel.LoadLayout("CustomDialogLayout")
   For i = 1 To 20
       CLVDialog.AddTextItem("Item #" & i, i)
   Next
   Wait For CLVDialog_ItemClick (Index As Int, Value As Object)
   Log("Selected item: " & Value)
   cd.CloseDialog(DialogResponse.POSITIVE)
End Sub
 
Upvote 0
I confirm that transparent dialog will not work on android 4, so i really need any help here... :rolleyes:
 
Upvote 0
here with small project how i show the dialog, in android 4 (emulator and real device) the dialog color still white while in android 7 the color was transparent as expected.

Thank you for your enlightment
 

Attachments

  • TransparentDialog.zip
    TransparentDialog.zip
    11.3 KB · Views: 424
  • Screenshot_2017-12-01-15-36-42.png
    Screenshot_2017-12-01-15-36-42.png
    33.4 KB · Views: 492
  • Screenshot_20180522-150411.png
    Screenshot_20180522-150411.png
    49.1 KB · Views: 392
Upvote 0
This is not the correct way to build the dialog. You should instead set the size of the dialog to match the actual content.

SS-2018-05-23_09.40.29.png


Tips:
1. Remove the call to AutoScaleAll as the exact size is important here.
2. Code to set the dialog:
Code: Copy
cd.ShowAsync("", "", "", "", Null, False)
cd.SetSize(280dip + 32dip, 220dip - 14dip)
Wait For Dialog_Ready (DialogPanel As Panel)
Log(DialogPanel)
DialogPanel.LoadLayout("1")

3. The panel with the content should be at the top of the layout.
 

Attachments

Upvote 0
Back
Top