I am having a problem with alert dialog. When I create an alert dialog, the default behavior is to display without a divider. I want to get something exactly like the image below
My code is displaying something different like an extra line at the bottom of last list item which I don't want.
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog alertDialogObject = builder.create();
builder.setItems(valueList, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
editField.setText(valueList[item]);
editField.setError(null);
editField.requestFocus();
}
});
alertDialogObject = builder.create();
ListView listView=alertDialogObject.getListView();
listView.setDivider(new ColorDrawable(Color.LTGRAY)); // set color
listView.setDividerHeight(2); // set height
alertDialogObject.show();
Can someone help with this? I want to get dialog alert like the first picture above?