Android Question Solved: PreferencesDialog and ShortOptions

udg

Expert
Licensed User
Longtime User
Hi all,
I'm trying to change the default height for a panel used for the ShortOptions type because the selected item is only partially visible.
My test code:
B4X:
Dim sf As Object = prefdialog.ShowDialog(Options1, "OK", "CANCEL")
For i = 0 To prefdialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = prefdialog.PrefItems.Get(i)
        If pi.ItemType = prefdialog.TYPE_SHORTOPTIONS Then
            Dim ft As B4XView = prefdialog.CustomListView1.GetPanel(i)        'CLV's panel for ShortOptions
            Log("panel: "&ft.Height)  '100
            Dim ft2 As B4XView = ft.GetView(1)                                                 'ShortOptions panel
            Log("so view: "&ft2.Height)  '60
            Dim ft3 As B4XView = ft2.GetView(0)                                              'ComboBox
            Log("cb: "&ft3.Height)  '60
           
            ft.Color = Starter.xui.Color_Green
            ft.Height = 80dip                                                    'ft.SetLayoutAnimated(0,0dip,0dip,prefdialog.CustomListView1.AsView.Width,80dip)
            ft2.Top = 0dip
            ft2.Height = 60dip
            ft2.Color = Starter.xui.Color_Magenta
            ft3.Top=0dip
            ft3.Height=50dip
        End If
Next
Wait For (sf) Complete (Result As Int)
Reading back heigth values at the end of the for-loop shows them having the new size (80dip-->160, 60dip-->120..), but visually the preference dialog stays the same as if the new values weren't take in any consideration.
 

udg

Expert
Licensed User
Longtime User
Never mind, solved.
B4X:
Dim Item As CLVItem = prefdialog.CustomListView1.GetRawListItem(1)
Dim ItemPanel As B4XView = Item.Panel.GetView(0)
ItemPanel.RemoveViewFromParent
prefdialog.CustomListView1.ReplaceAt(1,ItemPanel,90dip,Item.Value)
Or even
B4X:
Dim ft As B4XView = prefdialog.CustomListView1.GetPanel(1)        'CLV's panel for ShortOptions
Dim vl As Object = ft.tag
ft.RemoveViewFromParent
prefdialog.CustomListView1.ReplaceAt(1,ft,90dip,vl)

Note: I'm just testing so the above is relative to my testing code. BTW, I have yet to study original lib's code so my hints could be only partially right.
 
Upvote 0
Top