【发布时间】:2019-06-10 14:43:34
【问题描述】:
如何实现下图对话框中标题和按钮上可以看到的水平分隔线或标高?
我已经安装了材料组件库并使用dialog documentation作为指导。
代码如下:
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(this.getActivity());
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_settings, null);
setupView(view);
materialAlertDialogBuilder.setView(view);
materialAlertDialogBuilder.setTitle("Settings");
materialAlertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
});
materialAlertDialogBuilder.setNegativeButton("CANCEL", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
});
materialAlertDialogBuilder.setCancelable(false);
materialAlertDialogBuilder.create();
materialAlertDialogBuilder.show();
MaterialAlertDialogBuilder 似乎没有设置这个属性的能力。
【问题讨论】:
-
@JeelVankhede 样式不存在
-
@JeelVankhede,不幸的是,上面的图片中没有一种样式
-
好吧..我的错..只是想帮忙????
-
请注意,上面的图片应该是一个模型,并不代表Android中的实际原生实现。
-
@Edric 很遗憾,它看起来很酷。想也许我可以使用一种风格,而不必自己做“繁重的工作”
标签: android material-design android-alertdialog material-components-android