B4A Code Snippet [B4X] MeasureMultilineTextHeight - Alexander Stolte    May 11, 2023   (15 reactions) I was looking for a way to determine the height of a textview when it has multiline text. This function now makes that possible across platforms. From B4J I come from this thread: https://www.b4x.-multiline-text-height.84331/#content Private Sub MeasureMultilineTextHeight(xLabel As B4XView) As Doubl B4J Code Snippet Measure Multiline Text Height - Erel    Jun 11, 2020   (9 reactions) Usage example:
Dim height As Double = MeasureMultilineTextHeight(fx.DefaultFont(20), 100, $" jskldf jslkd fjlk wel;fk we;lfk we;lf k
erg
erg
erg
er
gsdfj lksdf jlksd fjlksd f"$)
Log(height)
Note that if you want to add it to a class then you need to remove the 'static' modifier from the Java code B4A Question [solved]Why button text not center_vertical? - klaus (first post)    May 25, 2018   (1 reaction) It is possible to calculate the text height with the MeasureMultilineTextHeight method from the StringUtils library.
Then you need to know the Padding of the view, which are are extra spaces arround the text.
Additionnally, buttons with the default background are smaller than the external dimensions B4A Question Measure text - ykucuk    Sep 12, 2023 Height
PanelInput.SetLayoutAnimated(0,PanelInput.Left,PanelInput.Top,PanelInput.Width,PanelHe.top +PanelHe.Height+2dip)
PanelBox.SetLayoutAnimated(0,PanelBox.Left,PanelBox.Top,PanelBox.Width,PanelHe.top +PanelHe.Height+2dip)
y=y+1
If y>0 Then
B4A Question [B4X] [SOLVED] xCustomListView Text Padding question - Alexander Stolte (first post)    Jul 12, 2021 i'm using this code in some projects, to calculate the height of text.
https://www.b4x.com/android/forum/threads/b4x-xui-add-measuretextwidth-and-measuretextheight-to-b4xcanvas.91865/post-580637
It's important to add a gap from 2-4dip to the height. B4A Question Calculate width and Height of a Text - Erel (first post)    May 16, 2020   (1 reaction) Turtle.DrawText measures the text height in order to vertically center it.
You can create a B4XCanvas in your code and use it to measure the text dimensions. What are you trying to do? B4J Code Snippet Measure Text - nw11 (first post)    Jan 26, 2015   (1 reaction) Is there any way to get the Height with a prefixed Width ?
i have to size a variable text lenght object into a prefixed width panel ( es. width 100dip )
Example B4A :
EditText1.Width = 100dip
EditText1.Height = su.MeasureMultilineTextHeight(EditText1, "prova inserimento testo multilinea riga 1 pr B4A Question Best view (control) for showing a large text file - klaus (first post)    May 06, 2024   (4 reactions) GetText(File.DirAssets, "text1.txt") ' load the text file into the string End Sub Sub SetText Dim ht As Float lblText.Text = txt ' set the text string to the Label text property ht = StrUtil.MeasureMultilineTextHeight(lblText, txt) ' measure Label height B4A Code Snippet [B4X] [XUI] Accurate Text Measurement and Drawing - Erel    Dec 12, 2022   (54 reactions) (It took me 7 years to get this one right.)
67684
https://www.b4x.com/basic4android/images/SS-2018-05-09_13.04.52.png
https://www.b4x.com/basic4android/images/SS-2018-05-09_13.05.38.png
XUI v1.60 includes a new method named B4XCanvas.MeasureText. This method accurately measures single line stri B4A Question Blank text retrieval from sqlite db - klaus (first post)    Jun 06, 2024   (4 reactions) According to the answer in post #2, have you tried this, ?
Do While rs.NextRow
LabelforLg.Text = rs.GetString("Body")
Labelhead1.Text = rs.GetString("PageTitle")
LabelforLg.Height = strUtils.MeasureMultilineTextHeight(LabelforLg, LabelforLg.Text)
LG_Scr Page: 1   2   3   4   5   6   7   Powered by ColBERT |