如何从Java的文本视图中获取HTML代码?
我看到这个主题告诉我如何在Java中的TextView中显示HTML文本。例如,如果我的 TextView 有“Hello”作为其文本,并且我使用了该主题中的代码,我会在 TextView 中看到一个小“Hello”。
现在我想扭转这一局面。我想获取我已启用HTML格式的TextView的HTML代码,即我想获取“Hello!”。有办法做到这一点吗?
我尝试过 tv.getText()
(tv 是 TextView 的名称),但它返回了“Hello”,而不是我预期的那样。
I saw this topic that tells me how to display HTML text in a TextView in Java. For example, if my TextView has "<small>Hello</small>" as its text and I used the code in that topic, I would see a small "Hello" in my TextView.
Now I want to reverse this. I want to get the HTML code of the TextView that I have enabled HTML format, i.e., I want to get "<small>Hello!</small>". Is there a way to do this?
I have tried tv.getText()
(tv is the name of the TextView), but it instead returned "Hello", not as I had expected.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论