1. store data in array. xml
The content of array. XML is as follows:
<String-array name = "newhouse_check_zone"> <item> none </item> <item> all </item> <item> sets </item> <item> total area </ item> <item> total amount </item> </string-array>
2. InProgramTo call the spzone is my spinner control, and the layout of the drop-down list is the default layout of a drop-down list of Android. I set the string zone to null when "NONE" is displayed.
Spzone. setadapter (arrayadapter. createfromresource (this, R. array. newhouse_check_zone, android. r. layout. simple_spinner_dropdown_item); spzone. setonitemselectedlistener (New onitemselectedlistener () {@ overridepublic void onitemselected (adapterview <?> Arg0, view arg1, int arg2, long arg3) {zone = spzone. getselecteditem (). tostring (); If (zone. equals ("NONE") {zone = NULL ;}@ overridepublic void onnothingselected (adapterview <?> Arg0) {zone = NULL ;}});