在点击Android中选择的TextView文本 [英] Select text from textview on one click in android

查看:321
本文介绍了在点击Android中选择的TextView文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个触摸我希望得到一个选项来选择和TextView中复制的文本类的形象展示在这里。

In one touch i want to get a option to select and copy the text from textview like the image show here.

推荐答案

在你的<一个href="http://stackoverflow.com/questions/3328757/how-to-click-or-tap-on-a-textview-text">onClickListener为TextView的:

ClipboardManager clipboard =
    (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); 
clipboard.setText(yourTextView.getText());

ED :答案在评论这个问题:

ed : Answer to the question in comments :

  yourTextView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO: add your code here

        }
    });

这篇关于在点击Android中选择的TextView文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆