-1

I have made a paint app in which i want to draw line with finger move over imageview in xml file. ImageView is used to show an image that can be zoom with finger move.But problem is that when we add bitmap to imageview by using the code

localBitmap = Bitmap.createBitmap(myBitmap.getWidth(), myBitmap.getHeight(),
                  Config.ARGB_8888);
myCanvas = new Canvas(localBitmap);
mImageView.setImageBitmap(localBitmap);

then we get a black screen.how to resolve this problem so that we can draw line over imageview and retain zoom with imageview. please help me. thanks for any help.

1 Answers1

0

One solution is to add listeners to imageview and handle there the events and presentations (on touch, on click you can check it which gives best result). To receive events you should enable it. This will be the fastest execution, less memory consumption. You can take a look here how is implemented the onTouch. Drag and Drop api docs

Other is matter of preference and MVC like design pattern: Add layers to View: add a background layer, add "drawed line" layer, and maybe the third layer to receive controls. This is easier to understand for others ( public api) , easy to maintain code ( after 6 months) but use more memory, and I think it is slower too ( because more objects allocated and suck)

Community
  • 1
  • 1