我正在寻找任何理解这种方法的线索.
有中没有信息官方Android的SDK文档了.
它返回什么样的矩形?
它是否像MotionEvent中的Raw coorinates一样充满了?
如果这个视图不可见怎么办?它返回null吗?或者某个带有某种VIEW_INVISIBLE值的矩形?
任何有使用这种方法经验的人都可以帮我吗?
Lea*_*rtS 21
来自getGlobalVisibleRect的JavaDoc:
/**
* If some part of this view is not clipped by any of its parents, then
* return that area in r in global (root) coordinates. To convert r to local
* coordinates (without taking possible View rotations into account), offset
* it by -globalOffset (e.g. r.offset(-globalOffset.x, -globalOffset.y)).
* If the view is completely clipped or translated out, return false.
*
* @param r If true is returned, r holds the global coordinates of the
* visible portion of this view.
* @param globalOffset If true is returned, globalOffset holds the dx,dy
* between this view and its root. globalOffet may be null.
* @return true if r is non-empty (i.e. part of the view is visible at the
* root level.
*/
Run Code Online (Sandbox Code Playgroud)
getLocalVisibleRect调用getGlobalVisibleRect,然后按照建议将其设置为local:
r.offset(-offset.x, -offset.y); // make r local`
Run Code Online (Sandbox Code Playgroud)
所以:
visibility="gone"| 归档时间: |
|
| 查看次数: |
13781 次 |
| 最近记录: |