专注于android开发
/** * Get the boundary of a view in screen coordinates. * 类似 Windows SDK 中的 GetWindowRect + ClientToScreen * @param v * @param r The result. */ private void getRectInScreen(View v, Rect r) { final int w = v.getWidth(); final int h = v.getHeight(); r.left = v.getLeft(); r.top = v.getTop(); r.right = r.left + w; r.bottom = r.top + h; ViewParent p = v.getParent(); while(p instanceof View) { v = (View)p; p = v.getParent(); r.left += v.getLeft(); r.top += v.getTop(); r.right = r.left + w; r.bottom = r.top + h; } }
posted on 2009-11-29 11:36 android开发 阅读(1256) 评论(0) 收藏 举报
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3