spinnerMonth = (Spinner) findViewById(R.id.spinmonth);
ArrayAdapter adapter
= ArrayAdapter.createFromResource(this,
R.array.month, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerMonth.setAdapter(adapter);

res/value/array.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
 <!--  Used in CarFinance.java -->
 <string-array name="month">
  <item>24</item>
  <item>36</item>
  <item>48</item>
  <item>60</item>
  <item>72</item>
  <item>84</item>
 </string-array>
</resources>


Android : spinner

Comments

comments

Tagged on: