@Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {

        for (int i = 0; i < getChildCount(); i++) {
            View child = getChildAt(i);
            child.setTag(i);
            VoronoiRegion region = mRegions.get(i);
            child.measure(
                    MeasureSpec.makeMeasureSpec((int) region.width, MeasureSpec.AT_MOST),
                    MeasureSpec.makeMeasureSpec((int) region.height, MeasureSpec.AT_MOST)
            );
            int curWidth = child.getMeasuredWidth();
            int curHeight = child.getMeasuredHeight();

            //set children into the center of the region rectangle
            child.layout(
                    (int) region.center_rect.x - curWidth / 2,
                    (int) region.center_rect.y - curHeight / 2,
                    (int) region.center_rect.x + curWidth,
                    (int) region.center_rect.y + curHeight
            );
        }
    }
Set layer-type HARDWARE or SOFTWARE for the view (true/false).

@param enabled True if should be hardware acceleration, false if should be software
vorolay/src/main/java/quatja/com/vorolay/VoronoiView.java