我在警告对话框中有一个微调器元素,但是当我点击微调元素时,这些项目没有显示。对话框本身工作正常,唯一的问题是使用微调器。
AlertDialog.Builder adb_spremeni = new AlertDialog.Builder(getContext());
LayoutInflater li = LayoutInflater.from(getContext());
final View myView = li.inflate(R.layout.update_projekt_layout, null);
adb_spremeni.setView(myView);
adb_spremeni.setCancelable(false)
.setPositiveButton("Spremeni", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
eNaslov = (EditText) myView.findViewById(R.id.spremeni_naslov);
Spinner sStanje = (Spinner) myView.findViewById(R.id.spremeni_stanje);
String[] s = {"pomembno", "kriticno", "nujno"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(myView.getContext(),
android.R.layout.simple_spinner_item, s);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sStanje.setAdapter(adapter);
String pos = getItem(position).getId();
String naslov = eNaslov.getText().toString();
String spremeni_stanje = sStanje.getSelectedItem().toString();
onItemClickInterface.getOnItemClickId("spremeniProjekt", naslov, spremeni_stanje, Long.valueOf(pos), "");
}
})
.setNegativeButton("Prekliči", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
Toast.makeText(getContext(), "Preklical sem", Toast.LENGTH_LONG).show();
}
});
AlertDialog alertDialog_spremeni = adb_spremeni.create();
alertDialog_spremeni.setCancelable(true);
alertDialog_spremeni.show();