Awa*_*esh 3 android android-alertdialog
我正在使用警报对话框来显示 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 默认按钮分隔符删除,会出现问题,因为您的项目在 ListView 中膨胀,布局为 simple_list_item - 其底部是分隔符。解决方案是将分隔线高度设置为 0:
AlertDialog alertDialog = builder.create();
alertDialog.getListView().setDividerHeight(0);
编辑:在 API 21 上测试 - 即使没有添加也没有行。
| 归档时间: | 
 | 
| 查看次数: | 2899 次 | 
| 最近记录: |