Spinner下拉列表.docx
《Spinner下拉列表.docx》由会员分享,可在线阅读,更多相关《Spinner下拉列表.docx(18页珍藏版)》请在冰豆网上搜索。
Spinner下拉列表
Spinner下拉列表
extendsAbsSpinner
implementsDialogInterface.OnClickListener
java.lang.Object
↳android.view.View
↳android.view.ViewGroup
↳android.widget.AdapterView
↳android.widget.AbsSpinner
↳android.widget.Spinner
KnownDirectSubclasses
AppCompatSpinner
ClassOverview
Aviewthatdisplaysonechildatatimeandletstheuserpickamongthem.TheitemsintheSpinnercomefromtheAdapterassociatedwiththisview.
SeetheSpinnersguide.
Summary
XMLAttributes
AttributeNameRelatedMethodDescription
android:
dropDownHorizontalOffsetsetDropDownHorizontalOffset(int)Amountofpixelsbywhichthedropdownshouldbeoffsethorizontally.
android:
dropDownSelectorListselectortouseforspinnerMode="dropdown"display.
android:
dropDownVerticalOffsetsetDropDownVerticalOffset(int)Amountofpixelsbywhichthedropdownshouldbeoffsetvertically.
android:
dropDownWidthsetDropDownWidth(int)WidthofthedropdowninspinnerMode="dropdown".
android:
gravitysetGravity(int)Gravitysettingforpositioningthecurrentlyselecteditem.
android:
popupBackgroundsetPopupBackgroundResource(int)BackgrounddrawabletouseforthedropdowninspinnerMode="dropdown".
android:
promptTheprompttodisplaywhenthespinner'sdialogisshown.
android:
spinnerModeDisplaymodeforspinneroptions.
[Expand]
InheritedXMLAttributes
Fromclassandroid.widget.AbsSpinner
Fromclassandroid.view.ViewGroup
Fromclassandroid.view.View
Constants
intMODE_DIALOGUseadialogwindowforselectingspinneroptions.
intMODE_DROPDOWNUseadropdownanchoredtotheSpinnerforselectingspinneroptions.
[Expand]
InheritedConstants
Fromclassandroid.widget.AdapterView
Fromclassandroid.view.ViewGroup
Fromclassandroid.view.View
[Expand]
InheritedFields
Fromclassandroid.view.View
PublicConstructors
Spinner(Contextcontext)
Constructanewspinnerwiththegivencontext'stheme.
Spinner(Contextcontext,intmode)
Constructanewspinnerwiththegivencontext'sthemeandthesuppliedmodeofdisplayingchoices.
Spinner(Contextcontext,AttributeSetattrs)
Constructanewspinnerwiththegivencontext'sthemeandthesuppliedattributeset.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr)
Constructanewspinnerwiththegivencontext'stheme,thesuppliedattributeset,anddefaultstyleattribute.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr,intmode)
Constructanewspinnerwiththegivencontext'stheme,thesuppliedattributeset,anddefaultstyle.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr,intdefStyleRes,intmode)
Constructanewspinnerwiththegivencontext'stheme,thesuppliedattributeset,anddefaultstyle.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr,intdefStyleRes,intmode,Resources.ThemepopupTheme)
Constructsanewspinnerwiththegivencontext'stheme,thesuppliedattributeset,defaultstyles,popupmode(oneofMODE_DIALOGorMODE_DROPDOWN),andthecontextagainstwhichthepopupshouldbeinflated.
PublicMethods
CharSequencegetAccessibilityClassName()
Returntheclassnameofthisobjecttobeusedforaccessibilitypurposes.
intgetBaseline()
Returntheoffsetofthewidget'stextbaselinefromthewidget'stopboundary.
intgetDropDownHorizontalOffset()
Gettheconfiguredhorizontaloffsetinpixelsforthespinner'spopupwindowofchoices.
intgetDropDownVerticalOffset()
Gettheconfiguredverticaloffsetinpixelsforthespinner'spopupwindowofchoices.
intgetDropDownWidth()
Gettheconfiguredwidthofthespinner'spopupwindowofchoicesinpixels.
intgetGravity()
Describeshowtheselecteditemviewispositioned.
DrawablegetPopupBackground()
Getthebackgrounddrawableforthespinner'spopupwindowofchoices.
ContextgetPopupContext()
CharSequencegetPrompt()
voidonClick(DialogInterfacedialog,intwhich)
Thismethodwillbeinvokedwhenabuttoninthedialogisclicked.
voidonRestoreInstanceState(Parcelablestate)
Hookallowingaviewtore-applyarepresentationofitsinternalstatethathadpreviouslybeengeneratedbyonSaveInstanceState().
ParcelableonSaveInstanceState()
Hookallowingaviewtogeneratearepresentationofitsinternalstatethatcanlaterbeusedtocreateanewinstancewiththatsamestate.
booleanonTouchEvent(MotionEventevent)
Implementthismethodtohandletouchscreenmotionevents.
booleanperformClick()
Callthisview'sOnClickListener,ifitisdefined.
voidsetAdapter(SpinnerAdapteradapter)
SetstheSpinnerAdapterusedtoprovidethedatawhichbacksthisSpinner.
voidsetDropDownHorizontalOffset(intpixels)
Setahorizontaloffsetinpixelsforthespinner'spopupwindowofchoices.
voidsetDropDownVerticalOffset(intpixels)
Setaverticaloffsetinpixelsforthespinner'spopupwindowofchoices.
voidsetDropDownW