Nick
Nick

Reputation: 6385

Android drag two images on canvas

My end goal here is to be able to add two (or more) images to a view/canvas, then turn that canvas into a single bitmap. I've seen many similar SO posts about dragging images around on a view, however, none of them cover dragging multiple images.

I am currently using the matrix commands to rotate and zoom, which work fine but only for one image. The code I am using is similar to this post. The issue here is that using fill_parent on the image will only allow for one image to be dragged because it is on top of the other image. Using wrap_content will only allow the image to be dragged within the confines of how big the image currently is, producing a cropped looking image.

So, is there anyway to edit this code (or use fresh code) to allow multiple images to be dragged and/or zoomed? As I've mentioned, there are many other SO posts about this but none have any solid answers.

Upvotes: 1

Views: 1559

Answers (1)

wsanville
wsanville

Reputation: 37516

Check out the demo app from the project Android Multitouch Controller, pretty much everything is done for you already. It lets you drag, rotate, and scale many images on a custom View. I've used this in the past for a custom image cropper, and it worked out great.

As for turning the resulting Canvas into a Bitmap, I've got a modified version of the Android Multitouch Controller project to do exactly that. You can see that project on GitHub.

Upvotes: 1

Related Questions