導航:首頁 > 源碼編譯 > android文本編輯器源碼

android文本編輯器源碼

發布時間:2022-08-30 11:44:02

① 如何實現一個 android 端的富文本編輯器

利用XML進行文本內容和格式描述,圖片音頻資源通過uri引入,XML解析就自己添加咯。

② 如何實現一個 Android 端的富文本編輯器

  1. WebView + javaScript;

  2. EditText + Span;

  3. scrollview + view;

  1. 效果圖:

其他

在scrollview實現一些view的添加和刪除,以及組件間的拼接,就可以實現一個很簡單的可定製的富文本編輯器。

③ 如何實現一個 Android 端的富文本編輯器

RichEditor for Android 是 Android的一個超酷的所見即所得的富文本編輯器控制項。
它支持的功能有:Bold、Italic、Subscript、Superscript、Strikethrough、Underline、Justify Left、Justify Center、Justify Right、Heading 1、Heading 2、Heading 3、Heading 4、Heading 5、Heading 6、Undo、Redo、Indent、Outdent、Insert Image、Insert Link、Text Color、Text Background Color、Milestone、Blockquote
RichEditor 是一個繼承自 WebView 的自定義 view,枚舉類型 Type 定了它所支持的排版格式。
編輯器的核心功能由 js 實現,RichEditor 封裝了 js 的功能,為上層提供了 java 介面

④ 如何實現一個 Android 端的富文本編輯器

參考如下知乎的內容:

在 Android 上實現富文本編輯器的思路大致分為三種:
使用多種 Layout 布局,每一種布局對應一種 HTML 格式,比如圖片,比如順序列表等。具體的實現例子可以參考這個鏈接。 Medium 和 Evernote 的富文本編輯就是採用這種方式實現的。總體來說比較復雜。
WebView + JavaScript 實現。現在 Web 端有很多成熟的 JavaScript 富文本編輯庫,比如 Squire ,你只需要做好 WebView 和 JavaScript 的交互就可以了(多寫回調函數)。理論上雖然是這么說,但是在實現過程你需要解決 WebView 的兼容性問題( Android 4.4 及其以上版本和 4.4 以下版本的 WebView 內核不一樣),以及其他一些不可預見的問題(比如我就遇到無法粘貼文字的問題)。
EditText + Span 。 Android 的 TextView 原生支持諸如粗體、刪除線、引用等 Span ,要實現簡單的富文本編輯需求,可操作性還是比較大的。綜合再三,我選擇了這種方式來實現自己的需求。

⑤ android文本編輯器,那位那位高人有源碼 給發一份

你已經好高了………………

坐等更高的

網上找了個JAVA的,看看有用沒

public class FileUtils
{
public static final int S_IRWXU = 00700;
public static final int S_IRUSR = 00400;
public static final int S_IWUSR = 00200;
public static final int S_IXUSR = 00100;

public static final int S_IRWXG = 00070;
public static final int S_IRGRP = 00040;
public static final int S_IWGRP = 00020;
public static final int S_IXGRP = 00010;

public static final int S_IRWXO = 00007;
public static final int S_IROTH = 00004;
public static final int S_IWOTH = 00002;
public static final int S_IXOTH = 00001;

public static final class FileStatus {
public int dev;
public int ino;
public int mode;
public int nlink;
public int uid;
public int gid;
public int rdev;
public long size;
public int blksize;
public long blocks;
public long atime;
public long mtime;
public long ctime;
}

public static native boolean getFileStatus(String path, FileStatus status);

private static final Pattern SAFE_FILENAME_PATTERN = Pattern.compile("[\\w%+,./=_-]+");

public static boolean File(File srcFile, File destFile) {
boolean result = false;
try {
InputStream in = new FileInputStream(srcFile);
try {
result = ToFile(in, destFile);
} finally {
in.close();
}
} catch (IOException e) {
result = false;
}
return result;
}

public static boolean ToFile(InputStream inputStream, File destFile) {
try {
if (destFile.exists()) {
destFile.delete();
}
OutputStream out = new FileOutputStream(destFile);
try {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) >= 0) {
out.write(buffer, 0, bytesRead);
}
} finally {
out.close();
}
return true;
} catch (IOException e) {
return false;
}
}

public static boolean isFilenameSafe(File file) {
return SAFE_FILENAME_PATTERN.matcher(file.getPath()).matches();
}

public static String readTextFile(File file, int max, String ellipsis) throws IOException {
InputStream input = new FileInputStream(file);
try {
long size = file.length();
if (max > 0 || (size > 0 && max == 0)) {

if (size > 0 && (max == 0 || size < max)) max = (int) size;
byte[] data = new byte[max + 1];
int length = input.read(data);
if (length <= 0) return "";
if (length <= max) return new String(data, 0, length);
if (ellipsis == null) return new String(data, 0, max);
return new String(data, 0, max) + ellipsis;
} else if (max < 0) { // "tail" mode: keep the last N
int len;
boolean rolled = false;
byte[] last = null, data = null;
do {
if (last != null) rolled = true;
byte[] tmp = last; last = data; data = tmp;
if (data == null) data = new byte[-max];
len = input.read(data);
} while (len == data.length);

if (last == null && len <= 0) return "";
if (last == null) return new String(data, 0, len);
if (len > 0) {
rolled = true;
System.array(last, len, last, 0, last.length - len);
System.array(data, 0, last, last.length - len, len);
}
if (ellipsis == null || !rolled) return new String(last);
return ellipsis + new String(last);
} else {
ByteArrayOutputStream contents = new ByteArrayOutputStream();
int len;
byte[] data = new byte[1024];
do {
len = input.read(data);
if (len > 0) contents.write(data, 0, len);
} while (len == data.length);
return contents.toString();
}
} finally {
input.close();
}
}
}

⑥ 如何實現一個 Android 端的富文本編輯器

jota文本編輯器和jota ,基本全漢化的,小巧精悍,我用它們寫txt和html很方便。jota 我有破解版的,能同時打開多個文件。尤其是這兩款是我見過的安卓上唯一帶強悍的正則表達式替換功能的文本編輯器。用此功能可以過濾html標識符,實現html轉txt。要的話上傳附件給你。計數器在文件→屬性裡面。

⑦ 用android開發一個簡單的文本編輯器,我想提供給用戶設置字體大小和閱讀模式,應該怎麼做

索愛ST17i是安卓2.3的系統所以不能直接修改系統字體。但可以自己修改。首先確定你的手機已經ROOT了,才可以修改。然後安裝RE管理器,再進入SYSTEM找到BUILD.PROP,長按,出現選擇菜單,選擇用文本編輯器打開,更改ro.sf.lcd_density等號後面的數字,240為目前常規大小字體,167為該ROM原始默認,200則是修改版數值,167-240間可任意選擇一個數字,然後按menu(最中間實體鍵)選擇保存並退出,重啟手機即可。還有更簡單的方法,下載一款名叫「LCDDensityChanger」的應用就可以直接修改了。下載地址這里發不了,用短消息發給你了。

閱讀全文

與android文本編輯器源碼相關的資料

熱點內容
解除電腦加密文件夾 瀏覽:358
androidcheckbox組 瀏覽:546
linux在線安裝軟體 瀏覽:823
如何設置手機安卓版 瀏覽:285
簡歷pdfword 瀏覽:123
鋒雲視頻伺服器網關設置 瀏覽:162
linux伺服器如何查看網卡型號 瀏覽:142
加密相冊誤刪了怎麼恢復 瀏覽:380
安卓代練通怎麼下載 瀏覽:518
知道域名如何查詢伺服器 瀏覽:906
方舟手游怎麼才能進伺服器 瀏覽:289
抖音演算法自動爆音 瀏覽:24
linux修改網卡配置 瀏覽:913
雲伺服器和本地伺服器數據 瀏覽:843
在家如何創業python 瀏覽:225
編譯原理好課 瀏覽:717
python中實數的表示 瀏覽:372
php下載中文名文件 瀏覽:351
哪裡有專門注冊app實名的 瀏覽:273
魔爪mx穩定器app去哪裡下載 瀏覽:469