所以我有一个自定义对话框布局,其中有一个微调器。我试图填充它,但似乎仍然是空的。请帮忙!
活动
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_upcoming);
itemList = (ListView) findViewById(R.id.listView1);
departmentDialogView = (View)getLayoutInflater().inflate(R.layout.custom_filter_department_dialog, null);
Spinner spinDepartment = (Spinner) departmentDialogView.findViewById(R.id.spinner_department);
db = new DatabaseHelper(getApplicationContext());
allItems = db.getAllItems();
allProducts = db.getAllProducts();
departments = this.getDepartments();
//Set department spinner
String[] itemsDepartment = departments.toArray(new String[departments.size()]);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,itemsDepartment);
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinDepartment.setAdapter(spinnerArrayAdapter);
自定义对话框布局XML
<Spinner
android:id="@+id/spinner_department"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
</RelativeLayout>