用于编写文档的 Android 富文本编辑器:Knife
admin
9年前
Knife 是一款可用于编写文档的 Android 富文本编辑器, 支持插入链接, 字体倾斜, 加粗等操作。
只要选中文本然后使用一行代码就能够加样式。支持Android 4.0+
示例
Here has a demo apk, and it's source code, very easy to understand~
Api
-
bold(boolean valid) bold the selected text.
-
italic(boolean valid) italic the selected text.
-
underline(boolean valid) <u>underline</u> the selected text.
-
strikethrough(boolean valid) strikethrough the selected text.
-
bullet(boolean valid) bullet the selected text.
-
quote(boolean valid) quote the selected text.
-
link(String link) and link(String link, int start, int end) to link the text.
-
contains(int FORMAT) return true if the selected text contains the FORMAT.
-
clearFormats() clear all formats.
-
redo() when text changed, you can redo it!
-
undo() when text change, you can also undo it!