Michael Eilers Smith
Michael Eilers Smith

Reputation: 8608

Moving shape over imageview?

I'm trying to find a way to implement a shape (a rectangle) that can be moved over an image. The user would drag the rectangle to an area in the image, as to eventually select it.

How can this be done? What should I use? Any help would be appreciated!

Upvotes: 1

Views: 125

Answers (1)

Yauraw Gadav
Yauraw Gadav

Reputation: 1746

Use canvas

    choosenImageView = (ImageView) this.findViewById(R.id.ChoosenImageView);

    canvas = new Canvas(bitmap); //Bitmap
    mBitmapPaint = new Paint();
    mBitmapPaint.setAntiAlias(true);
    mBitmapPaint.setStyle(Paint.Style.STROKE);
    mBitmapPaint.setStrokeWidth(5);
    choosenImageView.setOnTouchListener(this);

Upvotes: 1

Related Questions