Spanish B4A - MANTENER TAMAÑO LETRA ESTABLECIDA EN EL DISEÑO DE LA APP

Anton Solans Argemí

Active Member
Licensed User
¿Hay alguna manera de mantener el tamaño de la letra con la que he diseñado la APP independientemente del tamaño de letra que tenga configurado en el móbil?
 

pcicom

Member
Licensed User
Longtime User
No se si el siguiente codigo te sirva..

B4X:
Sub ResetUserFontScale(p As Panel)
    For Each v As View In p
        If v Is Panel Then
            ResetUserFontScale(v)
        Else If v Is Label Then
            Dim lbl As Label = v
            lbl.TextSize = lbl.TextSize / access.GetUserFontScale
        Else If v Is Spinner Then
            Dim s As Spinner = v
            s.TextSize = s.TextSize / access.GetUserFontScale
        End If
    Next
End Sub
 

Anton Solans Argemí

Active Member
Licensed User
Para un ListView no me lo acaba de hacer correctamente. He añadido el siguiente código que adjunto, que estoy haciendo mal? O es que no se puede hacer para ListView?:

B4X:
Sub ResetUserFontScale(p As Panel)
   For Each v As View In p
     If v Is Panel Then
       ResetUserFontScale(v)
     Else If v Is Label Then
       Dim lbl As Label = v
       lbl.TextSize = lbl.TextSize / Main.access.GetUserFontScale
     Else If v Is Spinner Then
       Dim s As Spinner = v
       s.TextSize = s.TextSize / Main.access.GetUserFontScale
     [B]else if v Is ListView Then
         Dim LV As ListView = v
        LV.SingleLineLayout.Label.TextSize=LV.SingleLineLayout.Label.TextSize / Main.access.GetUserFontScale
        LV.TwoLinesLayout.Label.TextSize=LV.TwoLinesLayout.Label.TextSize / Main.access.GetUserFontScale   [/B]     
     End If
   Next
End Sub
[ENDCODE]
 

musaso

Active Member
Licensed User
Yo lo hago con CSBuilder y me funciona bastante bien.
B4X:
Dim cs as CSBuilder
Dim tamanotexto as int = 12
cs.Initialize.Size(tamanotexto).Color(Colors.Blue).Append(Txt).PopAll
 
Top