public int getCurrentCursorLine(EditText editText) {
int selectionStart = Selection.getSelectionStart(editText.getText());
Layout layout = editText.getLayout();
if (!(selectionStart == -1)) {
return layout.getLineForOffset(selectionStart);
}
return -1;
}
EditText获取第几行
最新推荐文章于 2024-02-04 12:59:02 发布