Android 在EditText多行输入框中确定光标所在行

来源:互联网 发布:汇编语言编程 编辑:程序博客网 时间:2024/05/21 08:52
获取光标所在行:
public int getCurrentCursorLine(EditText editText){int selectionStart = Selection.getSelectionStart(editText.getText());Layout layout = editText.getLayout();if(-1 != selectionStart){return layout.getLineForOffset(selectionStart);}return -1;}
                                             
0 0
原创粉丝点击