Here you can find the source of layoutChildAbsoluteCenter(ViewGroup parent, View child, int tWidth, int tHeight)
public static final void layoutChildAbsoluteCenter(ViewGroup parent, View child, int tWidth, int tHeight)
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static final void layoutChildAbsoluteCenter(ViewGroup parent, View child, int tWidth, int tHeight) { int w, h, x, y; w = child.getMeasuredWidth();/*from w w w .ja v a2s. c o m*/ h = child.getMeasuredHeight(); x = centerSize(tWidth, w); y = centerSize(tHeight, h); child.layout(x, y, x + w, y + h); } public static final int centerSize(int total, int inside) { return (total - inside) >> 1; } }