简体   繁体   中英

How to set image overlay on another image on specified X and Y position on main image?

how to set small images on main image in specified x and y position , my main image also zoom functionality so if user zoom image than the another all image also set specified x and y position as per zoom level. please any one suggest which step follow for this ....

In such cases i suggest extending the ImageView class and overriding the onDraw() method. There you can call super.onDraw() first which will draw your underlying image as you would expect it from the ImageView.

Now you draw whatever you want ontop of it (and you can also care about the scaling then).

Are you familiar with inheritence and overriding in java or do you need more detailed information?

You can try matrix.setTranslate(float dx, float dy) to do position chaning, or u can try view.offsetLeftAndRight(int offset) functions.

Hope it will be helpful.

BTW, matrix can only works after api level 11

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM