B4A Class [B4X] [XUI] AutoTextSizeLabel

It is not recommented to use this class in B4J, the textsize is resetting without reasons...

this class is based on the Original Class from @Erel.
It works on B4A, B4I and B4J.
I tested it with B4A and B4I.

IMG_0064 (2).jpg
Screenshot_20181207-150129__01 (1).jpg


Changelog
  • 1.00
    • Release
  • 1.01
    • New RefreshView
    • New BaseLabel to get the base view, to change view properties
  • 1.02
    • BugFix TextSize in B4A on single line was buggy
    • New Click Event (B4A and B4I only)
    • New LongClick Event (B4A and B4I only)
  • 1.03
    • Removes the Log messages
    • Max Font size is now 200 (before at 80)
    • setRefreshView is now RefreshView
Github: github.com/StolteX/AS_AutoTextSizeLabel

Have Fun :)
 

Attachments

Last edited:
Hi Alexander

Did you try testing it with with a short Label, say half the height of the left label containing "Two Words", with Text = "ONE".
I tried that and the "ONE" seems to be cutoff

Thanks
iCAB
 
It is not recommented to use this class in B4J, the textsize is resetting without reasons...

Hi @Alexander Stolte

The label text size is working for me in B4J, the change i made is:

Code: Copy
Public Sub setText(value As Object)
   Sleep(0)
   mlbl.Text = value
   Dim multipleLines As Boolean = mlbl.Text.Contains(CRLF)
   Dim size, newSize As Float
   For size = 2 To 80
       newSize = size
       If CheckSize(size, multipleLines) Then Exit
   Next
   'mlbl.TextSize = newSize '<--- replace with line below
   CSSUtils.SetStyleProperty(mlbl,"-fx-font-size",newSize-2)
   Log(size)
   Log(mlbl.TextSize)
End Sub
 
Last edited:
Back
Top