在android中一键从textview中选择文本 [英] Select text from textview on one click in android
本文介绍了在android中一键从textview中选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一键式我想要一个选项来选择和复制文本视图中的文本,就像这里显示的图像一样.
In one touch i want to get a option to select and copy the text from textview like the image show here.
推荐答案
在你的 TextView 的 onClickListener:
ClipboardManager clipboard =
(ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(yourTextView.getText());
ed
:在评论中回答问题:
yourTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO: add your code here
}
});
这篇关于在android中一键从textview中选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文