Sus*_*gar 10 android android-widget android-emulator android-intent android-layout
我有一个edittext,其中选择了一些文本.我想在点击按钮时只从edittext中获取所选文本.
请建议我可用的链接或示例代码.
Moh*_*ikh 26
EditText et=(EditText)findViewById(R.id.edit);
int startSelection=et.getSelectionStart();
int endSelection=et.getSelectionEnd();
String selectedText = et.getText().toString().substring(startSelection, endSelection);
Run Code Online (Sandbox Code Playgroud)