gpt4 book ai didi

java - 如何更改警报对话框中按钮的颜色?

转载 作者:行者123 更新时间:2023-11-29 04:17:15 25 4
gpt4 key购买 nike

<分区>

我在一个社交应用程序中工作,当用户想要编辑他们的提要时,我想给他们一个弹出警告对话框,用户可以从中编辑他们的帖子。我尝试了以下代码,但给出的结果并不好 alert dialog

我想改变颜色并想要更好的设计..可以为此做些什么

private void EditCurrentPost(String description)
{
AlertDialog.Builder builder = new AlertDialog.Builder(ClickPostActivity.this);
builder.setTitle("Edit post");
final EditText inputField = new EditText(ClickPostActivity.this);
inputField.setText(description);
builder.setView(inputField);

builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ClickPostRef.child("description").setValue(inputField.getText().toString());
Toast.makeText(ClickPostActivity.this,"Post Updated",Toast.LENGTH_SHORT).show();

}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
Dialog dialog = builder.create();
dialog.show();
dialog.getWindow().setBackgroundDrawableResource(android.R.color.holo_purple);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com