【发布时间】:2017-12-20 15:17:53
【问题描述】:
我有一个数组字符串列表,我在材质对话框中填充值。当我单击对话框中的某个项目时,我想在该位置获取该项目并将值设置为 TextView。不幸的是,无论我选择哪个项目,我仍然将最后一个值设置为 TextView。
我的代码:
new MaterialDialog.Builder(DetailProfileActivity.this)
.title(R.string.id_types_title)
.items(set)
.itemsCallbackSingleChoice(0, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
idType = which;
switch (idType){
case 0:
txtIdType.setText("Voters");
case 1:
txtIdType.setText("Passport");
case 2:
txtIdType.setText("DriversLicense");
}
return true;
}
})
.positiveText(R.string.choose)
.show();
【问题讨论】:
-
@R2R 我的问题是即使我选择不同的选项,我也只能将值“DriversLicense”设置为我的 TextView。
标签: android dialog android-dialog