简体   繁体   English

文本格式设置类似于Android中的Web文本编辑器

[英]Text formatting as like web text editor in android

I am getting data from web service and displaying in the text view. 我正在从Web服务获取数据并显示在文本视图中。 In web side i have a text editor to enter the data for a field. 在网络方面,我有一个文本编辑器可以输入字段的数据。 Now i want to display the data as such the format given in the text editor say line spaces, line breaks, font styles, font sizes etc., in the andriod textview. 现在,我想以文本编辑器中给出的格式显示数据,例如在andriod textview中显示行间距,换行符,字体样式,字体大小等。 The web data is stored in server using php. Web数据使用php存储在服务器中。 Retrieving the data using json parsing. 使用json解析检索数据。 Is there any way to do this? 有什么办法吗?

Yes you can do it. 是的,你可以做到。

your_textview.setText(Html.fromHtml("Your_html_code_from_json"));

fromHtml() allow you to write html content in textview with html tags effects. fromHtml()允许您在具有html标签效果的textview中编写html内容。 I hope it helps you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM