我正在使用警告对话框来显示 whatsapp 中的操作。
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
我正在使用 setItems() 方法提供选项列表
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);
}
});
现在的问题是我想隐藏分隔符。任何帮助表示赞赏。 提前致谢:)
最佳答案
所以,根据这篇文章Alertdialog default button divider removal ,就会出现问题,因为您的项目在 ListView 中膨胀,布局为 simple_list_item - 其底部是分隔线。解决方案是将分隔线高度设置为 0:
AlertDialog alertDialog = builder.create();
alertDialog.getListView().setDividerHeight(0);
编辑:在 API 21 上测试 - 即使没有添加也没有行。
关于android - 警报对话框选项之间的分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33625026/