Android中長按textView彈出一個復制,editText長按彈出粘貼等等這個是怎樣做的,求大神解答!
android:textIsSelectable="true"在部分手機上不管用,你試試下面這個
textview.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
ClipboardManager cmb = (ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setText(textview.getText());
ToastUtil.show("已復制");
return false;
}
});