i try the post Cross platform chat layout example, i facing a problem when i write many words without new line, message cannot show all, also emoji
how can i change the message height to hold all words?
but we cannot limit end user to must add space to their message.
example like chinese words, when we write chinese word is no need add space,just continue.
This is related to BCTextEngine. It splits on word boundaries. You can change the list of "separators".
Currently BCTextEngine will never split what it considers complete words.
I'm not sure about the chat example. I have always created my own left/right conversation views, resized them based on the text, and filled up a CustomListView.
My Left/Right views consist of a Panel & Label:
And then resized them based on the content:
B4X:
Sub CreateLeftContentCard(text As String) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0, 0, 100%x , 60dip)
p.LoadLayout("messagescontentleft")
lblMessagesContentLeft.Text = text
lblMessagesContentLeft.Height = su.MeasureMultilineTextHeight(lblMessagesContentLeft, text) + 1dip
pnlMessagesContentLeft.Height = lblMessagesContentLeft.Height + 25dip
p.Height = pnlMessagesContentLeft.Height + 20dip
Return p
End Sub
Result:
For the textbox, I hook onto TextChanged and calculate/change the height of the panels accordingly.