目录搜索
androidManifestManifest.permissionManifest.permission_groupandroid.accessibilityserviceAccessibilityServiceandroid.accountsAccountandroid.appNotificationManagerandroid.bluetoothBluetoothAdapterBluetoothClassBluetoothClass.DeviceBluetoothClass.Device.MajorBluetoothClass.ServiceBluetoothDeviceBluetoothServerSocketBluetoothSocketandroid.contentSharedPreferencesandroid.database.sqliteSQLiteCursorDriverSQLiteOpenHelperandroid.graphicsBitmapandroid.locationLocationListenerGeocoderGpsStatusGpsStatus.ListenerGpsStatus.NmeaListenerGpsSatelliteandroid.mediaAudioFormatAsyncPlayerAudioRecordAudioRecord.OnRecordPositionUpdateListenerThumbnailUtilsAudioManagerandroid.netTrafficStatsMailToLocalSocketandroid.osAsyncTaskAsyncTask.StatusCountDownTimerMessageMessageQueueHandlerThreadandroid.textHtmlandroid.utilJsonWriterandroid.viewContextMenuContextMenu.ContextMenuInfoDisplayViewManagerViewViewStubViewTreeObserverViewParentWindowManagerGestureDetectorGravityMenuInflaterScaleGestureDetectorSoundEffectConstantsandroid.view.inputmethodInputConnectionInputMethodInputMethodSessionBaseInputConnectionInputMethodManagerandroid.widgetAbsListViewAbsListView.LayoutParamsAbsListView.OnScrollListenerAbsListView.RecyclerListenerAbsoluteLayoutAbsoluteLayout.LayoutParamsAbsSeekBarAbsSpinnerAdapterViewAdapterView.AdapterContextMenuInfoAdapterView.OnItemLongClickListenerAdapterView.OnItemSelectedListenerAdapterView.OnItemClickListenerAnalogClockBaseAdapterBaseExpandableListAdapterButtonCheckBoxCheckedTextViewCheckableChronometerChronometer.OnChronometerTickListenerCompoundButtonCompoundButton.OnCheckedChangeListenerCursorAdapterCursorTreeAdapterDatePickerDatePicker.OnDateChangedListenerDialerFilterDigitalClockEditTextFilterFilter.FilterListenerFilter.FilterResultsExpandableListAdapterExpandableListView.OnChildClickListenerExpandableListView.OnGroupClickListenerExpandableListView.OnGroupCollapseListenerExpandableListView.OnGroupExpandListenerFilterableGalleryGallery.LayoutParamsGridViewGridLayoutGridLayout.AlignmentRadioGroupImageViewImageView.ScaleTypeHorizontalScrollViewImageButtonImageSwitcherFilterQueryProviderListAdapterListViewMediaControllerMultiAutoCompleteTextViewMultiAutoCompleteTextView.CommaTokenizerMultiAutoCompleteTextView.TokenizerQuickContactBadgeRadioButtonRatingBarRatingBar.OnRatingBarChangeListenerRelativeLayoutRemoteViewsResourceCursorAdapterResourceCursorTreeAdapterScrollerScrollViewSearchViewSearchView.OnCloseListenerSearchView.OnQueryTextListenerSearchView.OnSuggestionListenerSeekBarSeekBar.OnSeekBarChangeListenerSimpleAdapterSimpleAdapter.ViewBinderSimpleCursorAdapterSimpleCursorAdapter.CursorToStringConverterSimpleCursorAdapter.ViewBinderSimpleCursorTreeAdapterSimpleCursorTreeAdapter.ViewBinderSimpleExpandableListAdapterSlidingDrawerSlidingDrawer.OnDrawerCloseListenerSlidingDrawer.OnDrawerOpenListenerSlidingDrawer.OnDrawerScrollListenerSpinnerSpinnerAdapterWrapperListAdapterTabHostTabHost.TabSpecTextViewTimePickerTimePicker.OnTimeChangedListenerToastTableLayoutTableLayout.LayoutParamsTableRowTableRow.LayoutParamsTabWidgetTextSwitcherToggleButtonTwoLineListItemVideoViewViewAnimatorViewFlipperViewSwitcherViewSwitcher.ViewFactoryZoomButtonsControllerZoomButtonsController.OnZoomListenerZoomButtonZoomControlsdalvik.systemDexFile
文字


AnalogClock

农民伯伯

版本:Android 2.2 r1

 

public class AnalogClock extends View

 

java.lang.Object

android.view.View

       android.widget.AnalogClock

 

概述

        

         这个控件是一个带有时针和分针的模拟时钟。

 

受保护方法

         protected void onAttachedToWindow ()

         视图(AnalogClock)附在窗体时调用。在调用时,视图在窗体表面并开始绘制。注意保证这个方法在onDraw(Canvas)以前被调用,但是它可以在首次onDraw以前任何时间调用——包括onMeasure(int, int)之前或之后。

 

         protected void onDetachedFromWindow ()

         视图(DigitalClock)从窗体上分离(移除)时调用,同时窗体表面不再绘制视图。

 

         protected void onDraw (Canvas canvas)

         实现你自己的绘制。

                   参数

                            canvas    在画布上绘制背景

 

         protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

测量这个视图以确定其内容的高度和宽度。通过measure(int, int)来调用这个方法,并且应该由子类重写以提高内容测量的效率和精确度。

约定:当该方法被重写时,你必须调用setMeasuredDimension(int, int)来存储已测量视图的高度和宽度。否则将通过measure(int, int)抛出一个IllegalStateException异常。调用父类的onMeasure(int, int)方法是一个有效的办法。

父类的实现是以背景大小为默认大小,除非MeasureSpec(测量细则)允许更大的背景。  为了更好测量内容子类应该重写onMeasure(int, int)

如果这个方法被重写,子类有责任确保测量它的高度和宽度至少是视图的最小宽度和高度(getSuggestedMinimumHeight()getSuggestedMinimumWidth())。

参数

widthMeasureSpec         由于父类有横向空间要求,参见View.MeasureSpec

                            heightMeasureSpec        由于父类有纵向空间要求,参见View.MeasureSpec

 

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

         布局期间当视图的大小发生改变时调用。如果只是添加到视图,调用时显示的是旧值0。(译者注:也就是添加到视图时,oldwoldh返回的是0

                  参数

         w     视图当前宽度

         h      视图当前高度

         oldw        视图以前的宽度

         oldh         视图以前的高度


上一篇:下一篇: