@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); //获取SingleTouchView所在父布局的中心点 ViewGroup mViewGroup = (ViewGroup) getParent(); if(null != mViewGroup){ mParentWidth = mViewGroup.getWidth(); mParentHeight = mViewGroup.getHeight(); } }