简体   繁体   English

有没有一种方法可以使用CSS存储和显示HTML以在Android中实现文本格式?

[英]Is there a way to store and display HTML with CSS to achieve text formatting in Android?

I'm creating a note taking app for Android and i would like the user to be able to format their text, ie bold, different text sizes. 我正在为Android创建一个记笔记应用程序,我希望用户能够设置其文本格式,即粗体,不同的文本大小。

What I would like to know is how can I do this bearing in mind the text will have to be store-able in a database. 我想知道的是,考虑到文本必须可存储在数据库中,我该如何做到这一点。

Can i use a web view with a string of HTML i pull from the database and a custom defined CSS to style it on the user end? 我可以在Web视图中使用从数据库中提取的HTML字符串和自定义的CSS来在用户端设置样式吗?

I also know there is some sort of formatting class in Android but im unsure of how it work, im not convinced it would be easy to store the formatting information. 我也知道Android中有某种格式设置类,但不确定其工作原理,也不相信存储格式设置信息会很容易。

I think you should use Spannable text. 我认为您应该使用可扩展文本。 See android.text.*. 参见android.text。*。 I think you should store the text in HTML markup. 我认为您应该将文本存储在HTML标记中。 Also take a look at http://developer.android.com/guide/faq/commontasks.html#selectingtext 还可以看看http://developer.android.com/guide/faq/commontasks.html#selectingtext

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

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