Here you can find the source of positionAndResizeView(View v, Rect rect)
public static void positionAndResizeView(View v, Rect rect)
//package com.java2s; import android.graphics.Rect; import android.view.View; import android.widget.RelativeLayout; public class Main { public static void positionAndResizeView(View v, Rect rect) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( v.getLayoutParams().width, v.getLayoutParams().height); params.setMargins(rect.left, rect.top, 0, 0); v.setLayoutParams(params);//w w w . j a va 2s . com } }