Android Question [solved] How to increase the default font size of Preference Dialog ?

AnandGupta

Expert
Licensed User
Longtime User
The text input of pref.dialog show very tiny text font size, see screen-shots

ba1.png

I tried to increase the font size, as there are enough spaces below the text by using some codes from the forum search, but failed.
How can I increase the default font size ?

( the example is from https://www.b4x.com/android/forum/t...ncesdialog-cross-platform-forms.103842/#posts)
 
Solution
B4X:
Private Sub PrefDialog_BeforeDialogDisplayed (Template As Object)
    prefdialog.CustomListView1.GetPanel(13).GetView(0).GetView(0).TextSize = 24
End Sub

Mahares

Expert
Licensed User
Longtime User
How can I increase the default font size ?
All the text fonts are located in the internal layouts of B4XPreferenceDialog, via the designer. for instance, for prefdialog.TYPE_TEXT they can changed in the layout: textitem, but the better way to change them is via code when you iterate over the list:
B4X:
For i = 0 To prefdialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = prefdialog.PrefItems.Get(i)
        If pi.ItemType = prefdialog.TYPE_TEXT Then
                 Dim ft As B4XFloatTextField = prefdialog.CustomListView1.GetPanel(i).GetView(0).Tag
                 ft.TextField.Font = xui.CreateDefaultBoldFont(34)    'or whatever you want
                'rest
         end if
 Next
By the way, when are you going to get rid of the mask
 
Upvote 1

AnandGupta

Expert
Licensed User
Longtime User
B4X:
Private Sub PrefDialog_BeforeDialogDisplayed (Template As Object)
    prefdialog.CustomListView1.GetPanel(13).GetView(0).GetView(0).TextSize = 24
End Sub
Thanks for the tip. This solved it and also now I know how to set other fields, if required :)
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
All the text fonts are located in the internal layouts of B4XPreferenceDialog, via the designer. for instance, for prefdialog.TYPE_TEXT they can changed in the layout: textitem, but the better way to change them is via code when you iterate over the list:
B4X:
For i = 0 To prefdialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = prefdialog.PrefItems.Get(i)
        If pi.ItemType = prefdialog.TYPE_TEXT Then
                 Dim ft As B4XFloatTextField = prefdialog.CustomListView1.GetPanel(i).GetView(0).Tag
                 ft.TextField.Font = xui.CreateDefaultBoldFont(34)    'or whatever you want
                'rest
         end if
 Next
By the way, when are you going to get rid of the mask
I already tried your similar code from another forum post but it gave error.
Anyway aeric post solved it.

As for mask, we are again experiencing lock-down due to increase in covid variant cases. Mask is must for outdoor now as per law.
 
Upvote 0
Top