B4J Question TableView height

giga

Well-Known Member
Licensed User
Longtime User
Erel,

I am testing with the TableView Example.
Is there a way to adjust the height of a cell(s) in the table or allow text to wrap and enlarge the cell. I have about 5 lines of text that needs to go in each cell.

Thanks as always for your expertise and assistance.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can add CRLF to your text to break it to multiple lines. The cells height will adjust to fit it.

Another option is to add Labels instead of strings. You can then set the label height and set word wrap:
B4X:
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "lksj dflkjs dflkjsd lkfjsd flksdj flksd fjlksdf jlsdkf jslkdf jsldkf jslkdf jsldkf "
lbl.PrefHeight = 100
Dim jlbl As JavaObject = lbl
jlbl.RunMethod("setWrapText", Array As Object(True))
row(0) = lbl
tv1.Items.Add(row)
 
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
You can add CRLF to your text to break it to multiple lines. The cells height will adjust to fit it.

Another option is to add Labels instead of strings. You can then set the label height and set word wrap:
B4X:
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "lksj dflkjs dflkjsd lkfjsd flksdj flksd fjlksdf jlsdkf jslkdf jsldkf jslkdf jsldkf "
lbl.PrefHeight = 100
Dim jlbl As JavaObject = lbl
jlbl.RunMethod("setWrapText", Array As Object(True))
row(0) = lbl
tv1.Items.Add(row)


Thanks, I knew you had it and I completely forgot CRLF :).
 
Upvote 0
Top