Zoom Content in a RelativeLayout

不打扰是莪最后的温柔 提交于 2019-11-28 19:02:15

What you're doing in your dispatchDraw(), is actually just zooming the drawing of the view, and not the view itself. The location and size of the view (left, top, right, bottom) is still the same, although you see the view's drawing in the canvas is zooming. Try this: zoom your ZoomRelativeLayoutjust a little bit, and then interact with the children in their original (non-zoom) location, and see whether the children reacts.

To really zoom a view/viewgroup, you need to transform the actual view, and not only the drawing, i.e. transform the (l,t,r,b) of the view, then requestLayout() invalidate(), but this might hit on the performance.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!