웹뷰에서 롱클릭했을때 저렇게 부분적으로 선택되고 저 부분을 클립보드로 복사하는걸,
텍스트뷰에서도 할 수 있나요?? 할 수 있는 방법 좀 알려주세요.
Indicates that the content of a non-editable text can be selected.
Must be a boolean value, either "true" or "false".
true
false
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
@[package:]type:name
?[package:][type:]name
This corresponds to the global attribute resource symbol textIsSelectable.
textIsSelectable
tMsg.setLongClickable(
);
tMsg.setOnLongClickListener(
new
OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
TextView tv = (TextView)v;
final String m = tv.getText().toString();
AlertDialog.Builder dial =
AlertDialog.Builder(mContext);
dial.setTitle(
"복사"
final CharSequence[] items ={
};
dial.setItems(items,
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
ClipboardManager clip = (ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
clip.setText(m);
dialog.dismiss();
}
});
dial.show();
return
;
클립보드 만드는 간단한 코드입니다.
한번 확인해보시기 바랍니다!^^ 도움이 되셨으면 좋겠네요~*