Spinner sp=(Spinner)findViewById(R.id.spinner);
Arraydapter<CharSequence> adapter=Arraydapter.createFromResource(this,R.array.gps,android.R.layout.simple_spinner_item);
adapter.setDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(adapter);
然后在value/array.xml里写
<resources>
<string-array name="gps">
<item>5</item>
<item>15</item>
<item>20</item>
<item>25</item>
<item>30</item>
<item>35</item>
</string-array>
<!-如果有多个spinner可以在下面加入《string-array》->
</resources>