I'm trying to showing a simple list dialog, with the default selected item by gray background. I know we can use setItems()
to show the list, but how do I set the checked item background to gray?
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
builder.setTitle(elementInfo.getName())
.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
editText.setText(items[which]);
elementInfo.setValue(elementInfo.getElementListValues().get(which).getValue());
updateSelection(elementInfo, which);
dialog.dismiss();
}
});
builder.create().show();
Following is the effort I want as Material Design Tutorial describes: https://material.io/guidelines/components/dialogs.html#dialogs-simple-dialogs