I have alert dialog with four items (Array of strings), I want to add divider between each item and first divider with different color, I saw it on android 4.4 kitkat like this
here's my Alert dialog code
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(getString(R.string.choose_layout));
String[] recyclerViewLayouts = getResources().getStringArray(R.array.RecyclerViewLayouts);
SharedPreferences.Editor editor = sharedPreferences.edit();
dialog.setItems(recyclerViewLayouts, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int index) {
}
}
});
dialog.create();
dialog.show();
I tried to create it with the following code but also not showing
AlertDialog alertDialog = builder.create();
ListView listView = alertDialog.getListView();
listView.setDivider(new ColorDrawable(Color.GRAY));
listView.setDividerHeight(1);
alertDialog.show();