I am using alert dialog to show actions as in whatsapp.
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
And i am supplying the list of options using setItems() method
dialog.setItems(options.toArray(new String[options.size()]), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(mContext, AddTaskActivity.class);
mContext.startActivity(intent);
}
});
But problem is that it is also showing separator between different options like this,
Screenshot:

Now the problem is that I want to hide the separators. Any help is appreciated. Thanks in advance :)
So, according to this post Alertdialog default button divider removal, the problem occurs, because your items are inflated in a ListView, with the layout simple_list_item - whose bottom is a divider. Solution was to set the divider height to 0:
AlertDialog alertDialog = builder.create();
alertDialog.getListView().setDividerHeight(0);
Edit: tested on API 21 - no lines even without the addition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With