public class

ButtonGridLayout

extends ViewGroup
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.android.phone.ButtonGridLayout

Class Overview

Create a 4x3 grid of dial buttons. It was easier and more efficient to do it this way than use standard layouts. It's perfectly fine (and actually encouraged) to use custom layouts rather than piling up standard layouts. The horizontal and vertical spacings between buttons are controlled by the amount of padding (attributes on the ButtonGridLayout element): - horizontal = left + right padding and - vertical = top + bottom padding. This class assumes that all the buttons have the same size. The buttons will be bottom aligned in their view on layout. Invocation: onMeasure is called first by the framework to know our size. Then onLayout is invoked to layout the buttons.

Summary

[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ButtonGridLayout(Context context)
ButtonGridLayout(Context context, AttributeSet attrs)
ButtonGridLayout(Context context, AttributeSet attrs, int defStyle)
Public Methods
void setChildrenBackgroundResource(int resid)
Set the background of all the children.
Protected Methods
void onFinishInflate()
Cache the buttons in a member array for faster access.
void onLayout(boolean changed, int left, int top, int right, int bottom)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
This method is called twice in practice.
[Expand]
Inherited Methods
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public ButtonGridLayout (Context context)

public ButtonGridLayout (Context context, AttributeSet attrs)

public ButtonGridLayout (Context context, AttributeSet attrs, int defStyle)

Public Methods

public void setChildrenBackgroundResource (int resid)

Set the background of all the children. Typically a selector to change the background based on some combination of the button's attributes (e.g pressed, enabled...)

Parameters
resid Is a resource id to be used for each button's background.

Protected Methods

protected void onFinishInflate ()

Cache the buttons in a member array for faster access. Compute the measurements for the width/height of buttons. The inflate sequence is called right after the constructor and before the measure/layout phase.

protected void onLayout (boolean changed, int left, int top, int right, int bottom)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

This method is called twice in practice. The first time both with and height are constraint by AT_MOST. The second time, the width is still AT_MOST and the height is EXACTLY. Either way the full width/height should be in mWidth and mHeight and we use 'resolveSize' to do the right thing.