我遇到的问题是我想在以下编码中为 android spinner 添加自定义字体。我已经尝试过使用 ArrayAdapter 但还不能成功。谢谢。
private void loadSpinner() {
List<String> list = new ArrayList<String>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
list.add("7");
list.add("8");
list.add("9");
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
cmbStage.setAdapter(dataAdapter);
cmbStage.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
Object item = parent.getItemIdAtPosition(pos + 1);
currentID = Integer.parseInt(item.toString());
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
}