Android View api 详解 - getLeft , getTop, getBottom, getRight

概述

掌握getLeft , getTop, getBottom, getRight的关键点:他们的取值是相对于父View的相对位置,单位是dx
Android View api 详解 - getLeft , getTop, getBottom, getRight

注意:以上方法在OnCreate方法中调用,都会返回0,这是因为View还未加载完毕;本文点击计算之后才开始获取View的getLeft , getTop, getBottom, getRight值。

源码点击此处下载