17
如何在Android中将文本复制到剪贴板?
有人可以告诉我如何在按下按钮时将特定textview中显示的文本复制到剪贴板吗? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainpage); textView = (TextView) findViewById(R.id.textview); copyText = (Button) findViewById(R.id.bCopy); copyText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); String getstring = textView.getText().toString(); //Help to continue :) } }); } } 我想在bCopy按下按钮时将TextView textView中的Text复制到剪贴板。