Làm thế nào tôi có thể cư một Spinner từ String array
, tôi biết tôi có thể làm điều đó từ array.xml
như thế này code
:Làm thế nào để cư một Spinner từ String mảng
ArrayAdapter<CharSequence> gameKindArray = ArrayAdapter.createFromResource(view.getContext(),R.array.game_kind, android.R.layout.simple_spinner_item);
gameKindArray.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
gameKind.setAdapter(gameKindArray);
nhưng khi tôi có
String[] test=new String[]{"test1","test2"};
làm thế nào tôi có thể thay đổi String[]
thành ArrayAdapter
?!
bản sao có thể có của [Android: Tạo spinner theo chương trình từ mảng] (http://stackoverflow.com/questions/2784081/android-create-spinner-programmatically-from-array) – Riser