我有一个画布,其中我从警告对话框中添加文本现在我想在canvas上拖动该文本。这是alertdialogbox的代码以及我如何在画布上拖动我的文本但拖动代码不起作用。所以ans plzz ...
AlertDialog.Builder builder1 = new AlertDialog.Builder(c_new);
final EditText editText = new EditText(c_new);
builder1.setTitle("Edit Text");
builder1.setMessage("Enter Your Text Here.");
builder1.setView(editText);
// builder1.setCancelable(true);
builder1.setPositiveButton(
"Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
srt = editText.getText().toString();
c.setEdittext(srt);
click_values c1 = new click_values();
c1.setImage(3);
dialog.cancel();
}
});
builder1.setNegativeButton(
"Cancle",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = builder1.create();
alertDialog.show();
pointerId2 = event.getPointerId(actionIndex);
touchedText = mCirclePointer2.get(pointerId2);
if (null != touchedText) {
touchedText.centerX = xTouch -xTouch1 / 2;
touchedText.centerY = yTouch -yTouch1 / 2;
}
答案 0 :(得分:0)
您可以使用此库android-StickerView
添加可拖动文字
// add a stickerText to canvas
StickerTextView tv_sticker = new StickerTextView(getContext());
tv_sticker.setText(“Hello World!”);
canvas.addView(tv_sticker);