- 获取光标位置
int index = editText.getSelectionStart();
2.在光标处插入字符
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.insert(index, “testtest”);
3.删除光标前字符
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.delete(index-1, index); void android.app.Activity.setTitle(int titleId)
Change the title associated with this activity. If this is a top-level activity, the title for its window will change. If it is an embedded activity, the parent can do whatever it wants with it.BitmapFactory.decodeResource(res, id);
android 基础知识
最新推荐文章于 2026-06-22 19:25:46 发布
本文深入探讨了Android应用中光标位置的获取、光标处字符的插入与删除,以及如何通过标题栏自定义Activity的标题。同时,介绍了如何使用资源ID解码位图,为开发者提供实用的文本编辑与界面定制技巧。

1237

被折叠的 条评论
为什么被折叠?



