Reputation: 1117
I'm developing and Android application, but I have some doubts about the feasibility of my project.
I have to implement a custom layout composed from a ImageView that show an image, in particular a VectorDrawable.
Overlapping the ImageView there is a SurfaceView that :
The purpose is to show a background image and use it as a reference, each time the user touches the screen a marker on SurfaceView must be inserted, this technique allows to simulate the insertion of a marker on an image.
The question is:
There are other better method to do this? I have implemented yet, the idea works, but I have some limitation about the SurfaView (for example I can't insert it in a ScrollView).
And at last:
Taking into consideration the reasoning made up to now, assuming to have a ImageView that show a VectorDrawable, is it possible create a function that magnify and lessen the image (VectorDrawable)?
p.s. I apologize for having put two questions but the whole is closely related, I thought it was foolish to open two threads
Upvotes: 3
Views: 159
Reputation: 672
Task 1: Your task is doable using a SurfaceView
but I'm assuming that after you draw your image you would want it to stay if that is the case you may have to keep track of each image separately. If your task is just drawing an image you can also override a View
which can do the same task but will also provide transparency and basic layout implementations. Difference between View
and SurfaceView
is performance, SurfaceView
is pretty low level with a double buffer and gives you more control. Also if the number of images are small you can override a FrameLayout
and spawn ImageView
. Its not very efficient but it will be easier to implement.
Task 2: You can scale an ImageView
easily by using setScaleX
and setScaleY
. But this may pixelate the image. Loading a large Bitmap
then drawing it on a custom view would be a better way.
Upvotes: 1