AS spinner

@Spinner

One, Spinner overview

1.
Spinner features: Spinner is a drop-down list box. When you click Spinner, a drop-down list will pop up for the user to choose, and only one item in the list can be displayed when it is displayed. The Spinner inheritance relationship is as follows: Insert picture description here
According to the inheritance relationship, Spinner is a subclass of ViewGroup's insight and can also be used as a container.
2. Link to official documentation of XML attributes and methods supported by Spinner

Serial number Attributes effect
01 dropDownHorizontalOffset setdropDownHorizontalOffset (int) Set the pull-down horizontal offset
02 dropDownVerticalOffset Set drop-down selector
03 dropdownVerticalOffset Set the drop-down vertical offset
04 dropdownWidth Set the width of the drop-down list
05 gravity setGravity(int) Alignment
06 PopupBackgroud setPopupBackgroundRouse(int) Set drop-down background
07 prompt setPrompt() Set the prompt text of the drop-down list
08 spinnerMode List box mode
09 entries Set the data source for the drop-down list box
10 setAdapter Set the drop-down list box and data source association
11 getPrompt Get reminder text
12 setOnItemClickListence() Click the event listener to register options for the drop-down list
13 setOnItemSelectedListener() Register an option event listener for the drop-down list box

Second, ArrayAdaper
overview: two major functions: one is to read the list items defined in the resource file, and the other is to use the array or List collection items,
methods:

method effect
public ArrayAdapter(Context context,int resource,Listobjects) Constructor, create an ArrayAdapter object in the current interface
public ArrayAdapter(Context,context,int resource,T[] objects Construction method, according to the specified list item display style and array data, create an ArrayAdapter object in the current interface
public static ArraryAdapter <CharSequen>cecreateFromResouce(Context context,int textArrayResld,int textViewResld) createFromResouce(Context context,int textArrayResld,int textViewResld) Create an ArrayAdapter object in the current interface through array resource and list item display style
Public void Set the display style of the drop-down list items
Published 15 original articles · Likes0 · Visits 149

Guess you like

Origin blog.csdn.net/qq_44230959/article/details/105041965