For now, use an EditText
. Use android:inputType="number"
to force it to be numeric. Convert the resulting string into an integer (e.g., Integer.parseInt(myEditText.getText().toString())
).
In the future, you might consider a NumberPicker
widget, once that becomes available (slated to be in Honeycomb).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…