Android Question How to resize PreferencesDialog

Drago Bratko

Member
Licensed User
I would like to make opened preference dialog bigger.
What I have tried are few options, but none of them did work.

B4X:
    Private prefdialog As PreferencesDialog
    Private OptionsKorisnik As Map

    prefdialog.Initialize(Activity, "Preferences Dialog", 300dip, 300dip)
    OptionsKorisnik.Initialize
    prefdialog.LoadFromJson(File.ReadString(File.DirAssets, "Korisnik.json"))

    Dim rs As Object = prefdialog.ShowDialog(OptionsKorisnik, "OK", "CANCEL")
'    prefdialog.CustomListView1.AsView.width=90%x
'    prefdialog.CustomListView1.AsView.Height=85%y
'    prefdialog.Dialog.Resize(90%x, 85%y)
'    prefdialog.Dialog.Resize(500dip, 500dip)

    Wait For (rs) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        For Each key As String In OptionsKorisnik.Keys
            If key = "" Then Continue 'separators
            Log(key & ": " & OptionsKorisnik.Get(key) & CRLF)
        Next
    End If
Any hint is more then welcome.
 

Drago Bratko

Member
Licensed User
Thank you for your feedback. I found my error … on initializing prefdialog I have put fix size … :) correct code from first post is this :

B4X:
    Private prefdialog As PreferencesDialog
    Private OptionsKorisnik As Map

    prefdialog.Initialize(Activity, "Preferences Dialog", 90%x, 90%y)
    OptionsKorisnik.Initialize
    prefdialog.LoadFromJson(File.ReadString(File.DirAssets, "Korisnik.json"))

    Dim rs As Object = prefdialog.ShowDialog(OptionsKorisnik, "OK", "CANCEL")

    Wait For (rs) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        For Each key As String In OptionsKorisnik.Keys
            If key = "" Then Continue 'separators
            Log(key & ": " & OptionsKorisnik.Get(key) & CRLF)
        Next
    End If
 
Top