Android examples for User Interface:View Property
offset Rect Between View
import java.util.ArrayList; import java.util.List; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.widget.TextView; public class Main{ private static final String TAG = ViewUtil.class.getSimpleName(); public static void offsetRectBetween(View source, View dest, Rect rectInSource) {/*from w ww .j a v a2s . com*/ View root = source.getRootView(); if (root instanceof ViewGroup) { ((ViewGroup) root).offsetDescendantRectToMyCoords(source, rectInSource); ((ViewGroup) root).offsetRectIntoDescendantCoords(dest, rectInSource); } else { Log.e(TAG, "view's parent is NOT a ViewGroup."); } } }