已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Spinner下拉列表extends AbsSpinnerimplements DialogInterface.OnClickListenerjava.lang.Object android.view.View android.view.ViewGroup android.widget.AdapterView android.widget.AbsSpinner android.widget.SpinnerKnown Direct SubclassesAppCompatSpinnerClass OverviewA view that displays one child at a time and lets the user pick among them. The items in the Spinner come from the Adapter associated with this view.See the Spinners guide.SummaryXML AttributesAttribute NameRelated MethodDescriptionandroid:dropDownHorizontalOffsetsetDropDownHorizontalOffset(int)Amount of pixels by which the drop down should be offset horizontally. android:dropDownSelectorList selector to use for spinnerMode=dropdown display. android:dropDownVerticalOffsetsetDropDownVerticalOffset(int)Amount of pixels by which the drop down should be offset vertically. android:dropDownWidthsetDropDownWidth(int)Width of the dropdown in spinnerMode=dropdown. android:gravitysetGravity(int)Gravity setting for positioning the currently selected item. android:popupBackgroundsetPopupBackgroundResource(int)Background drawable to use for the dropdown in spinnerMode=dropdown. android:promptThe prompt to display when the spinners dialog is shown. android:spinnerModeDisplay mode for spinner options. ExpandInherited XML AttributesFrom class android.widget.AbsSpinnerFrom class android.view.ViewGroupFrom class android.view.ViewConstantsintMODE_DIALOGUse a dialog window for selecting spinner MODE_DROPDOWNUse a dropdown anchored to the Spinner for selecting spinner options.ExpandInherited ConstantsFrom class android.widget.AdapterViewFrom class android.view.ViewGroupFrom class android.view.ViewExpandInherited FieldsFrom class android.view.ViewPublic ConstructorsSpinner(Context context)Construct a new spinner with the given contexts theme.Spinner(Context context, int mode)Construct a new spinner with the given contexts theme and the supplied mode of displaying choices.Spinner(Context context, AttributeSet attrs)Construct a new spinner with the given contexts theme and the supplied attribute set.Spinner(Context context, AttributeSet attrs, int defStyleAttr)Construct a new spinner with the given contexts theme, the supplied attribute set, and default style attribute.Spinner(Context context, AttributeSet attrs, int defStyleAttr, int mode)Construct a new spinner with the given contexts theme, the supplied attribute set, and default style.Spinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int mode)Construct a new spinner with the given contexts theme, the supplied attribute set, and default style.Spinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int mode, Resources.Theme popupTheme)Constructs a new spinner with the given contexts theme, the supplied attribute set, default styles, popup mode (one of MODE_DIALOG or MODE_DROPDOWN), and the context against which the popup should be inflated.Public MethodsCharSequencegetAccessibilityClassName()Return the class name of this object to be used for accessibility getBaseline()Return the offset of the widgets text baseline from the widgets top getDropDownHorizontalOffset()Get the configured horizontal offset in pixels for the spinners popup window of getDropDownVerticalOffset()Get the configured vertical offset in pixels for the spinners popup window of getDropDownWidth()Get the configured width of the spinners popup window of choices in getGravity()Describes how the selected item view is positioned.DrawablegetPopupBackground()Get the background drawable for the spinners popup window of choices.ContextgetPopupContext()CharSequencegetPrompt()voidonClick(DialogInterface dialog, int which)This method will be invoked when a button in the dialog is clicked.voidonRestoreInstanceState(Parcelable state)Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().ParcelableonSaveInstanceState()Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.booleanonTouchEvent(MotionEvent event)Implement this method to handle touch screen motion events.booleanperformClick()Call this views OnClickListener, if it is defined.voidsetAdapter(SpinnerAdapter adapter)Sets the SpinnerAdapter used to provide the data which backs this Spinner.voidsetDropDownHorizontalOffset(int pixels)Set a horizontal offset in pixels for the spinners popup window of choices.voidsetDropDownVerticalOffset(int pixels)Set a vertical offset in pixels for the spinners popup window of choices.voidsetDropDownWidth(int pixels)Set the width of the spinners popup window of choices in pixels.voidsetEnabled(boolean enabled)Set the enabled state of this view.voidsetGravity(int gravity)Describes how the selected item view is positioned.voidsetOnItemClickListener(AdapterView.OnItemClickListener l)A spinner does not support item click events.voidsetPopupBackgroundDrawable(Drawable background)Set the background drawable for the spinners popup window of choices.voidsetPopupBackgroundResource(int resId)Set the background drawable for the spinners popup window of choices.voidsetPrompt(CharSequence prompt)Sets the prompt to display when the dialog is shown.voidsetPromptId(int promptId)Sets the prompt to display when the dialog is shown.Protected MethodsvoidonDetachedFromWindow()This is called when the view is detached from a window.voidonLayout(boolean changed, int l, int t, int r, int b)Called from layout when this view should assign a size and position to each of its children.voidonMeasure(int widthMeasureSpec, int heightMeasureSpec)Measure the view and its content to determine the measured width and the measured height.ExpandInherited Methods From class android.widget.AbsSpinner From class android.widget.AdapterView From class android.view.ViewGroup From class android.view.View From class java.lang.Object From interface android.view.ViewParent From interface android.view.ViewManager From interface android.graphics.drawable.Drawable.Callback From interface android.view.KeyEvent.Callback From interface android.view.accessibility.AccessibilityEventSource From interface android.content.DialogInterface.OnClickListenerXML Attributesandroid:dropDownHorizontalOffsetAmount of pixels by which the drop down should be offset horizontally.Must be a dimension value, which is a floating point number appended with a unit such as 14.5sp. Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).This may also be a reference to a resource (in the form package:type:name) or theme attribute (in the form ?package:type:name) containing a value of this type.This corresponds to the global attribute resource symbol dropDownHorizontalOffset.Related MethodssetDropDownHorizontalOffset(int)android:dropDownSelectorList selector to use for spinnerMode=dropdown display.May be a reference to another resource, in the form +package:type:name or to a theme attribute in the form ?package:type:name.May be a color value, in the form of #rgb, #argb, #rrggbb, or #aarrggbb.This corresponds to the global attribute resource symbol dropDownSelector.Related Methodsandroid:dropDownVerticalOffsetAmount of pixels by which the drop down should be offset vertically.Must be a dimension value, which is a floating point number appended with a unit such as 14.5sp. Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).This may also be a reference to a resource (in the form package:type:name) or theme attribute (in the form ?package:type:name) containing a value of this type.This corresponds to the global attribute resource symbol dropDownVerticalOffset.Related MethodssetDropDownVerticalOffset(int)android:dropDownWidthWidth of the dropdown in spinnerMode=dropdown.May be a dimension value, which is a floating point number appended with a unit such as 14.5sp. Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).This may also be a reference to a resource (in the form package:type:name) or theme attribute (in the form ?package:type:name) containing a value of this type.May be one of the following constant values.ConstantValueDescriptionfill_parent-1The dropdown should fill the width of the screen. This constant is deprecated starting from API Level 8 and is replaced by match_parent.match_parent-1The dropdown should fit the width of the screen. Introduced in API Level 8.wrap_content-2The dropdown should fit the width of its anchor.This corresponds to the global attribute resource symbol dropDownWidth.Related MethodssetDropDownWidth(int)android:gravityGravity setting for positioning the currently selected item.Must be one or more (separated by |) of the following constant values.ConstantValueDescriptiontop0x30Push object to the top of its container, not changing its size.bottom0x50Push object to the bottom of its container, not changing its size.left0x03Push object to the left of its container, not changing its size.right0x05Push object to the right of its container, not changing its size.center_vertical0x10Place object in the vertical center of its container, not changing its size.fill_vertical0x70Grow the vertical size of the object if needed so it completely fills its container.center_horizontal0x01Place object in the horizontal center of its container, not changing its size.fill_horizontal0x07Grow the horizontal size of the object if needed so it completely fills its container.center0x11Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.fill0x77Grow the horizontal and vertical size of the object if needed so it completely fills its container.clip_vertical0x80Additional option that can be set to have the top and/or bottom edges of the child clipped to its containers bounds. The clip will be based on the vertical gravity: a top gravity will clip the bottom edge, a bottom gravity will clip the top edge, and neither will clip both edges.clip_horizontal0x08Additional option that can be set to have the left and/or right edges of the child clipped to its containers bounds. The clip will be based on the horizontal gravity: a left gravity will clip the right edge, a right gravity will clip the left edge, and neither will clip both edges.start0x00800003Push object to the beginning of its container, not changing its size.end0x00800005Push object to the end of its container, not changing its size.This corresponds to the global attribute resource symbol gravity.Related MethodssetGravity(int)android:popupBackgroundBackground drawable to use for the dropdown in spinnerMode=dropdown.May be a reference to another resource, in the form +package:type:name or to a theme attribute in the form ?package:type:name.May be a color value, in the form of #rgb, #argb, #rrggbb, or #aarrggbb.This corresponds to the global attribute resource symbol popupBackground.Related MethodssetPopupBackgroundResource(int)android:promptThe prompt to display when the spinners dialog is shown.Must be a reference to another resource, in the form +package:type:name or to a theme attribute in the form ?package:type:name.This corresponds to the global attribute resource symbol prompt.Related Methodsandroid:spinnerModeDisplay mode for spinner options.Must be one of the following constant values.ConstantValueDescriptiondialog0Spinner options will be presented to the user as a dialog window.dropdown1Spinner options will be presented to the user as an inline dropdown anchored to the spinner widget itself.This corresponds to the global attribute resource symbol spinnerMode.Related MethodsConstantspublic static final int MODE_DIALOGAdded in API level 11Use a dialog window for selecting spinner options.Constant Value: 0 (0x00000000)public static final int MODE_DROPDOWNAdded in API level 11Use a dropdown anchored to the Spinner for selecting spinner options.Constant Value: 1 (0x00000001)Public Constructorspublic Spinner (Context context)Added in API level 1Construct a new spinner with the given contexts theme.ParameterscontextThe Context the view is running in, through which it can access the current theme, resources, etc.public Spinner (Context context, int mode)Added in API level 11Construct a new spinner with the given contexts theme and the supplied mode of displaying choices. mode may be one of MODE_DIALOG or MODE_DROPDOWN.ParameterscontextThe Context the view is running in, through which it can access the current theme, resources, etc.modeConstant describing how the user will select choices from the spinner.See AlsoMODE_DIALOGMODE_DROPDOWNpublic Spinner (Context context, AttributeSet attrs)Added in API level 1Construct a new spinner with the given contexts theme and the supplied attribute set.ParameterscontextThe Context the view is running in, through which it can access the current theme, resources, etc.attrsThe attributes of the XML tag that is inflating the view.public Spinner (Context context, AttributeSet attrs, int defStyleAttr)Added in API level 1Construct a new spinner with the given contexts theme, the supplied attribute set, and default style attribute.ParameterscontextThe Context the view is running in, through which it can access the current theme, resources, etc.attrsThe attributes of the XML tag that is inflating the view.defStyleAttrAn attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.public Spinner (Context context, AttributeSet attrs, int defStyleAttr, int mode)Added in API level 11Construct a new spinner with the given contexts theme, the supplied attribute set, and default style. mode may be one of MODE_DIALOG or MODE_DROPDOWN and determines how the user will select choices from the spinner.ParameterscontextThe Context the view is running in, through which it can access the current theme, resources, etc.attrsThe attributes of the XML tag that is inflating the view.defStyleAttrAn attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.modeConstant describing how the user will select choices from the spinner.See AlsoMODE_DIALOGMODE_DROPDOWNpublic Spinner (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int mode)Added in API level 21Construct a new spinner with the given contexts theme, the supplied attribute set, and default style. mode may be one of MODE_DIALOG or MODE_DROPDOWN and determines how the user will select choices from the spinner.ParameterscontextThe Context the view is running in, through which it can access the current theme, resources, etc.attrsThe attributes of the XML tag that is inflating the view.defStyleAttrAn attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.defStyleResA resource identifier of a style resource that supplies default values for the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.modeConstant describing how the user will select choices from the spinner.See AlsoMODE_DIALOGMODE_DROPDOWNpublic Spinner (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int mode, Resources.Theme popupTheme)Added in API level 23Constructs a new spinner with the given contexts theme, the supplied attribute set, default styles, popup mode (one of MODE_DIALOG or MODE_DROPDOWN), and the context against which the popup should be inflated.ParameterscontextThe context against which the view is inflated, which provides access to the current theme, resources, etc.attrsThe attributes of the XML tag that is inflating the view.defStyleAttrAn attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.defStyleResA resource identifier of a style resource that supplies default values for the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.modeConstant describing how the user will select choices from the spinner.popupThemeThe theme against which the dialog or dropdown popup should be inflated. May be null to use the view theme. If set, this will override any value specified by Spinner_popupTheme.See AlsoMODE_DIALOGMODE_DROPDOWNPublic Methodspublic CharSequence getAccessibilityClassName ()Added in API level 23Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view wh
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 手机支架设计
- 弘扬宪法精神 建设法治校园
- 模拟急救科普讲解
- 耳鼻喉头颈外科咽喉炎药物治疗规范
- 托班毕业平面设计方案
- 毕业设计摄影创作全流程解析
- 室内设计材料工艺
- 高淇设计模式
- 放射科胸部X线摄影技术培训细则
- 下一代互联网环境下文件传输协议的服务质量研究
- 如何阐述自己的观点 高中语文统编版必修下册第一单元写作课课件
- 农村环保培训课件讲解
- 人工智能原理与方法智慧树知到课后章节答案2023年下哈尔滨工程大学
- GB/T 42430-2023血液、尿液中乙醇、甲醇、正丙醇、丙酮、异丙醇和正丁醇检验
- 走进舞蹈艺术-首都师范大学中国大学mooc课后章节答案期末考试题库2023年
- 小型挖掘机工况介绍
- 饲料原料知识和品控
- GB/T 7582-2004声学听阈与年龄关系的统计分布
- GB/T 4937.3-2012半导体器件机械和气候试验方法第3部分:外部目检
- GB/T 37356-2019色漆和清漆涂层目视评定的光照条件和方法
- GB/T 29128-2012船舶固定式气体灭火系统通用要求
评论
0/150
提交评论