用于編寫文檔的 Android 富文本編輯器:Knife

碼頭工人 8年前發布 | 9K 次閱讀 Knife Android開發 移動開發

Knife 是一款可用于編寫文檔的 Android 富文本編輯器, 支持插入鏈接, 字體傾斜, 加粗等操作。

只要選中文本然后使用一行代碼就能夠加樣式。支持Android 4.0+

示例

example.gif

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!

項目主頁:http://www.baiduhome.net/lib/view/home/1450225364797

 本文由用戶 碼頭工人 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!