我從json字符串獲取值並將其添加到arraylist getSpinArrList.I已發佈相關代碼。微調項目不顯示在微調框和微調框onClick監聽不工作
我的問題是,微調不顯示第一項和OnItemClick不在微調工作。
但是,如果我單擊微調框,我只能查看我從arraylist中獲得的項目。
MainActivity.java:
Spinner spinCrePage;
spinCrePage = (Spinner) findViewById(R.id.sp_create_page);
ArrayAdapter<String> adapter_state = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, getSpinArrList);
adapter_state.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinCrePage.setAdapter(adapter_state);
spinCrePage.setOnItemSelectedListener(this);
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position,
long id) {
Toast.makeText(getApplicationContext(),"Working" , Toast.LENGTH_SHORT).show();
spinCrePage.setSelection(position);
String selState = (String) spinCrePage.getSelectedItem();
// textView.setText("Selected Android OS:" + selState);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
getSpinArrList中有什麼? –