Ran*_*ku' 36
int pos = editText.getSelectionStart();
Layout layout = editText.getLayout();
int line = layout.getLineForOffset(pos);
int baseline = layout.getLineBaseline(line);
int ascent = layout.getLineAscent(line);
float x = layout.getPrimaryHorizontal(pos);
float y = baseline + ascent;
Run Code Online (Sandbox Code Playgroud)
然后你得到光标像素的x,y位置.
| 归档时间: |
|
| 查看次数: |
8085 次 |
| 最近记录: |