Skip to main content

Spinner

Overview

Drop-down selection box

Example

<Spinner android:layout_height="wrap_parent"
android:layout_width="match_parent"
android:tag="btn"
android:text="Option 1|Option 2"
android:textColor="#669999"
android:mode="dialog"
android:textSize="14dp"
android:defaultText="Option 2"
android:gravity="center"
/>

Properties

Common Properties

See Common Properties

Private Properties

PropertyDescriptionValues
layout_weightChild weightNumber
When the parent is LinearLayout, child controls can set weight
gravityInternal control alignmentUsage reference
top
bottom
left
right
center_vertical
fill_vertical
center_horizontal
fill_horizontal
center
fill
clip_vertical
clip_horizontal
textDrop-down optionsString
Separate multiple options with pipe |, e.g.: Option 1|Option 2
textColorText colorHex, e.g. #FFFFFF
textSizeText sizespecific number + dp
defaultTextDefault selected itemOne of the items in text
modeDisplay modedialog — dialog box; dropdown — drop-down mode
popupHeightPopup heightspecific number + dp