Android ViewGroup Set layoutChildAbsoluteCenter(ViewGroup parent, View child, int tWidth, int tHeight)

Here you can find the source of layoutChildAbsoluteCenter(ViewGroup parent, View child, int tWidth, int tHeight)

Description

layout Child Absolute Center

Declaration

public static final void layoutChildAbsoluteCenter(ViewGroup parent,
            View child, int tWidth, int tHeight) 

Method Source Code

//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;
    }
}

Related

  1. setReadingFontOnChildren(ViewGroup container)
  2. setSelected(ViewGroup viewGroup, boolean selected)
  3. disableView(ViewGroup rootView, float alpha)