annuaire recherche
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
personnages


DatePicker

农民伯伯

版本:Android 2.2 r1

 

public class DatePicker extends FrameLayout

 

java.lang.Object

android.view.View

       android.view.ViewGroup

              android.widget.FrameLayout

                     android.widget.DatePicker

 

概述

        

         一个选择年月日的日历布局视图。对于对话框样式的日历视图,参见DatePickerDialog.

 

公共方法

         public int getDayOfMonth ()

         获取选择的天数

 

         public int getMonth ()

         获取选择的月份。(注意:返回数值为0..11,需要自己+1来显示)

 

         public int getYear ()

         获取选择的年份

 

         public void init (int year, int monthOfYear, int dayOfMonth, DatePicker.OnDateChangedListener onDateChangedListener)

         初始化状态。(译者注:初始化年月日)

                   参数

                            year         初始年(译者注:注意使用new Date()初始化年时,需要+1900,如下:date.getYear() + 1900

                            monthOfYear 初始月。

                            dayOfMonth   初始日。

                            onDateChangedListener         日期改变时通知用户的事件监听,可以为空(null)

 

         public void setEnabled (boolean enabled)

         设置视图的启用状态。该启用状态随子类的不同而有不同的解释。

                   参数

                            enabled True if this view is enabled, false otherwise.设置为true表示启动视图,反之禁用。

 

         public void updateDate (int year, int monthOfYear, int dayOfMonth)

         更新日期

 

受保护方法

         protected void dispatchRestoreInstanceState (SparseArray<Parcelable> container)

         重写使我们能够完全控制这小部件的保存或恢复。(译者注:此处直接调用了父类的ViewGroup. dispatchThawSelfOnly方法)

                   参数

                            container         SparseArray 持有保存以前的状态。The SparseArray which holds previously saved state.

 

         protected void onRestoreInstanceState (Parcelable state)

         允许视图重新应用以前通过onSaveInstanceState()生成代表内部的状态。这个函数决不调用一个空的状态。

                   参数

                            state  返回以前调用onSaveInstanceState()保存下来的状态。

 

         protected Parcelable onSaveInstanceState ()

         允许视图生成一个代表内部的状态,以后可用于创建一个与之相同的新的实例。这种状态应该只包含非持久或以后不能够重建的信息。例如,你决不存储你当前在屏幕上的位置,因为这会在视图的层面上重新计算放置一个新的实例。

         你可以存储到这里的一些例子:一个文本框中当前光标的位置(但通常不是文字本身,文字通常保存在内容提供者(content provider)或其他持久的储存中),一个列表视图中的当前选中项。

                   返回值

                            返回一个包含视图当前状态的Parcelable对象,或没有什么状态保存时返回null。默认实现返回null


Article précédent: Article suivant: