Implementing a rich text editor in Android?

强颜欢笑 提交于 2019-11-26 19:32:32

I just published my rich text editor component under the Apache 2.0 license:

https://github.com/1gravity/Android-RTEditor

I would probably extend both EditText and TableLayout or at least end up using most of their source if there were big enough changes I needed to make.

Can you do the following:

  1. Manually hold the contents in the EditText as your own model (ie by seperating and maintaing the content document and the view attributes as seperate entities).
  2. Override the render (or draw method) to do custom layout on parts of the content document (part of your model) that handle non text characters (say bullets with particular attribute).

To me seems like if you have to muck about with the layout, are you better off writing it from scratch on your own. From what I remember the Edit text (and the richt text editor) is great for anything where you the data is pure text.

Jeff Axelrod

There is an open source EditText rich text editor called android-richtexteditor but the code was inexplicably deleted in r5. The code is still there in r4; just use svn to check out r4 or earlier to access it. The code appears to support italics, underline, color picker, text size, and more.

Also answered in these questions: 1, 2

Extend from EditText is a best choice for you, it support CharacterSpan and ParagraphSpan.

See my App on the Google Play: https://play.google.com/store/apps/details?id=com.hly.notes

Check this open source Wordpress mobile application for android.It has very promising Richtexteditor based on Edittext.

You can download the source from here

Thanks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!