HTML.fromHtml line breaks disappearing

后端 未结 3 1162
无人共我
无人共我 2021-01-02 03:55

I am taking Spanned Text from an EditText box and converting it to a HTML tagged string using HTML.toHtml. This works fine. I have verified that the string is correct and co

3条回答
  •  梦毁少年i
    2021-01-02 04:37

    I also had this problem and I could not find an easy "transform" or something alike solution. Note something important, when the user presses "enter" java produces the special character \n but in HTML there is no such format for line breaking. It is the
    .

    So what I have done was to replace some specific CharSequences, from the plain text, by the alternative HTML format. In my case there was only the "enter" character so it was not that messy.

提交回复
热议问题