目录 搜索
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
文字


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         视图以前的高度


上一篇: 下一篇: