Android 坐标系统

屏幕的左上角是坐标系统原点(0,0),原点向右延伸是X轴正方向,原点向下延伸是Y轴正方向。
一、View的坐标

    需要注意view的坐标是相对父容器而言的,包括:getTop()、getBottom(),getLeft(),getRight()。以getTop为例,函数源代码为:

/**
* Top position of this view relative to its parent.
*相对应父控件的top位置,单位为像素,即头部到父控件的距离
* @return The top of this view, in pixels.
*/ 
@ViewDebug.CapturedViewProperty 
public final int getTop() { 
    return mTop; 
}

图示1:

Android 坐标系统

图示2:

Android 坐标系统

1、视图左侧位置  view.getLeft()
    2、视图右侧位置 view.getRight()
    3、视图顶部位置 view.getTop();
    4、视图底部位置 view.getBottom();
    5、 视图宽度 view.getWidth();
    6、视图高度 view.getHeight()

上一篇:几个常用的linux命令(操作服务器时会用到)


下一篇:hive批量执行sql命令及使用小技巧