如何在按下按钮时将特定文本视图中的文本复制到剪贴板?
答案 0 :(得分:0)
点击按钮
下面的代码String stringcopy = textView.getText().toString();
int startIndex = textView.getSelectionStart();
int endIndex = textView.getSelectionEnd();
stringcopy = stringcopy.subString(startIndex, endIndex);
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(stringcopy);