A Svg Image Have 6 Icon And Need To Choose One?
I have an SVG file format in which there is 5-6 icon and I need to pick icon according to the requirement not the whole Image. In Simply you can parse the .SVG onto your ImageView
Solution 1:
I did not try it but you may :
- Create a Bitmap with the size of your icon
- Create a new Canvas associated to this Bitmap
- Draw your svg into the Canvas with an offset -- If your icon coordinates are (X1, Y1) -- Then when you draw an element substract SVG (X1, Y1)
- Draw the Bitmap on screen.
It is a little bit homemade solution... maybe there is some libraries doing those king of things for you.
Solution 2:
You could set a clip and translation on the canvas before drawing to hide all but the icon you want, but I think the best course of action is to use separate image files.
Solution 3:
You don't say which SVG library you are using. If you are using AndroidSVG, you could add <view>
elements to your SVG (one for each icon) and select the appropriate icon to draw using renderViewToPicture() etc.
Post a Comment for "A Svg Image Have 6 Icon And Need To Choose One?"