Code example for RelativeLayout

Methods: getHeight, getScaleX, getTranslationX, getTranslationY, getWidth, setTranslationX, setTranslationY

0
			float y = (mCurP[0].y - mPreP[0].y);
			 
			RectF rect = getMoveRectF(view, x, y);
			 
			if (Math.abs(rect.left) >= MOVE_TERM)	{
				view.setTranslationX(view.getTranslationX() + rect.left);	
			} 
		 
			if (Math.abs(rect.top) >= MOVE_TERM)	{
				view.setTranslationY(view.getTranslationY() + rect.top);
			} 
 
			mPreP[0].set(mCurP[0].x - (float)(x/2), mCurP[0].y  - (float)(y/2));
		} 
	} 
	 
	/** 
	 * <p>Get move rect after check availability move distance</p> 
	 * @param view		ScanvasContainer in ImageEditor 
	 * @param x			move x 
	 * @param y			move y 
	 * @return			availability rect 
	 */ 
	public RectF getMoveRectF(RelativeLayout view, float x, float y) {
		float scale = view.getScaleX();
		 
		float viewWidth = view.getWidth() * scale;
		float viewHeight = view.getHeight() * scale;
		 
		float remainWidth = (viewWidth - mSCanvasUtil.getSCanvasParentWidth()) / 2;
		float remainHeight = (viewHeight - mSCanvasUtil.getSCanvasParentHeight()) / 2;
		 
		float viewTransX = view.getTranslationX();
		float viewTransY = view.getTranslationY();
		 
		x *= scale;
		y *= scale;