我的对话问题需要一些帮助。我从自定义视图创建了dialogFragment,并设置了正/负按钮,如下所示:
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
builder.setView(inflater.inflate(R.layout.add_product, null)).
setPositiveButton(R.string.add, new DialogListener(getActivity(), true)).
setNegativeButton(R.string.cancel, new DialogListener(getActivity(), false));
return builder.create();
}
我更喜欢那种按钮的样式,在这种情况下如何使用它。
答案 0 :(得分:-1)
builder.setPositiveButton("Sighin", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
break;