Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.graphics.Region; import android.view.View; public class Main { private static final int[] sLocationTmp = new int[2]; /** * Helper for overriding {@link ViewGroup#gatherTransparentRegion} for views that are fully * opaque and have children extending beyond their bounds. If the transparent region * optimization is turned on (which is the case whenever the view hierarchy contains a * SurfaceView somewhere), the children might otherwise confuse the SurfaceFlinger. */ public static void gatherTransparentRegionsForOpaqueView(View view, Region region) { view.getLocationInWindow(sLocationTmp); region.op(sLocationTmp[0], sLocationTmp[1], sLocationTmp[0] + view.getRight() - view.getLeft(), sLocationTmp[1] + view.getBottom() - view.getTop(), Region.Op.DIFFERENCE); } }