Android
android.widget
public class

android.widget.AnalogClock

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.widget.AnalogClock

This widget display an analogic clock with two hands for hours and minutes.

Summary

XML Attributes inherited from class android.view.View
Constants inherited from class android.view.View
Fields inherited from class android.view.View

Public Constructors

            AnalogClock(Context context)
            AnalogClock(Context context, AttributeSet attrs)
            AnalogClock(Context context, AttributeSet attrs, int defStyle)

Protected Methods

          void  onAttachedToWindow()
This is called when the view is attached to a window.
          void  onDetachedFromWindow()
This is called when the view is detached from a window.
          void  onDraw(Canvas canvas)
Implement this to do your drawing.
          void  onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

          void  onSizeChanged(int w, int h, int oldw, int oldh)
This is called during layout when the size of this view has changed.
Methods inherited from class android.view.View
Methods inherited from class java.lang.Object
Methods inherited from interface android.graphics.drawable.Drawable.Callback
Methods inherited from interface android.view.KeyEvent.Callback

Details

Public Constructors

public AnalogClock(Context context)

public AnalogClock(Context context, AttributeSet attrs)

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

Protected Methods

protected void onAttachedToWindow()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

protected void onDetachedFromWindow()

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

protected void onDraw(Canvas canvas)

Implement this to do your drawing.

Parameters

canvas the canvas on which the background will be drawn

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override onMeasure(int, int) to provide better measurements of their content.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).

Parameters

widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

protected void onSizeChanged(int w, int h, int oldw, int oldh)

This is called during layout when the size of this view has changed. If you were just added to the view hierarchy, you're called with the old values of 0.

Parameters

w Current width of this view.
h Current height of this view.
oldw Old width of this view.
oldh Old height of this view.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48