我想显示一个对话框/弹出窗口,其中显示一条消息,显示"您确定要删除此条目吗?" 用一个按钮说"删除".当Delete被触摸时,应该删除该条目,否则什么都没有.
我为这些按钮编写了一个单击侦听器,但是如何调用对话框或弹出窗口及其功能?
如何AlertDialog在Android中更改按钮的颜色?
我在做什么:我正在创建一个自定义警报对话框
我想做什么:以及下面的代码,如何更改对话框中的操作按钮的颜色(正面和负面)
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setView(inflater.inflate(R.layout.dialog_signin, null))
// Add action buttons
.setPositiveButton(R.string.signin, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// sign in the user ...
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface …Run Code Online (Sandbox Code Playgroud)