B4A Class [B4X?] [XUI] MLabelAutoSize

Hi to all, i make a small CustomView that uses canvas e MeasureText to draw a text that autoresizes to cover the entire view, without stretching.
I tried to use XUI, and i put B4x? in title because i tried it only on B4a. All feedback is welcome. Feel free to extend it


  • example.zip
    10.3 KB · Views: 122
  • MLabelAutoSize.bas
    2.6 KB · Views: 95

Alexander Stolte

Licensed User
Had you tested these two before? :)

Emme Developer

Well-Known Member
Licensed User
Had you tested these two before? :)

I hadn't seen your library :) By the way, my implementation is a bit different than your and Erel solution. I don't use cycle and MesaureTextHeight to find the right font, i use canvas to draw the text. You can obviously use what you want, i start to develop this custom view to learn how works canvas and so on, so i shared it :)