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获取第几行
最新推荐文章于 2021-10-28 00:55:14 发布