Spinner下拉列表Word文档格式.docx
《Spinner下拉列表Word文档格式.docx》由会员分享,可在线阅读,更多相关《Spinner下拉列表Word文档格式.docx(18页珍藏版)》请在冰豆网上搜索。
![Spinner下拉列表Word文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/15/54d72c3e-63a8-48fb-b7d0-9aeaa117a181/54d72c3e-63a8-48fb-b7d0-9aeaa117a1811.gif)
↳android.widget.Spinner
KnownDirectSubclasses
AppCompatSpinner
ClassOverview
Aviewthatdisplaysonechildatatimeandletstheuserpickamongthem.TheitemsintheSpinnercomefromtheAdapterassociatedwiththisview.
SeetheSpinnersguide.
Summary
XMLAttributes
AttributeNameRelatedMethodDescription
android:
dropDownHorizontalOffsetsetDropDownHorizontalOffset(int)Amountofpixelsbywhichthedropdownshouldbeoffsethorizontally.
dropDownSelectorListselectortouseforspinnerMode="
dropdown"
display.
dropDownVerticalOffsetsetDropDownVerticalOffset(int)Amountofpixelsbywhichthedropdownshouldbeoffsetvertically.
dropDownWidthsetDropDownWidth(int)WidthofthedropdowninspinnerMode="
.
gravitysetGravity(int)Gravitysettingforpositioningthecurrentlyselecteditem.
popupBackgroundsetPopupBackgroundResource(int)BackgrounddrawabletouseforthedropdowninspinnerMode="
promptTheprompttodisplaywhenthespinner'
sdialogisshown.
spinnerModeDisplaymodeforspinneroptions.
[Expand]
InheritedXMLAttributes
Fromclassandroid.widget.AbsSpinner
Fromclassandroid.view.ViewGroup
Fromclassandroid.view.View
Constants
intMODE_DIALOGUseadialogwindowforselectingspinneroptions.
intMODE_DROPDOWNUseadropdownanchoredtotheSpinnerforselectingspinneroptions.
InheritedConstants
Fromclassandroid.widget.AdapterView
InheritedFields
PublicConstructors
Spinner(Contextcontext)
Constructanewspinnerwiththegivencontext'
stheme.
Spinner(Contextcontext,intmode)
sthemeandthesuppliedmodeofdisplayingchoices.
Spinner(Contextcontext,AttributeSetattrs)
sthemeandthesuppliedattributeset.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr)
stheme,thesuppliedattributeset,anddefaultstyleattribute.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr,intmode)
stheme,thesuppliedattributeset,anddefaultstyle.
Spinner(Contextcontext,AttributeSetattrs,intdefStyleAttr,intdefStyleRes,intmode)
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'
intgetDropDownWidth()
Gettheconfiguredwidthofthespinner'
spopupwindowofchoicesinpixels.
intgetGravity()
Describeshowtheselecteditemviewispositioned.
DrawablegetPopupBackground()
Getthebackgrounddrawableforthespinner'
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'
voidsetDropDownVerticalOffset(intpixels)
Setaverticaloffsetinpixelsforthespinner'
voidsetDropDownW