LayoutInflater fInflater = getLayoutInflater();
//申明一个 LayoutInflater
View view = fInflater.inflate(R.layout.app_header, (ViewGroup)findViewById(R.id.lay_dialog));
// R.layout.app_header 找到其所在的layout文件,
//指定确切的View
AlertDialog.Builder builder = new Builder(MainActivity.this);
//新建一个AlertDialog 并指定它所在的context
builder.setMessage("确定退出吗");
//设置其提示内容
builder.setTitle("温馨提示");
//设置其标题
builder.setPositiveButton("确定", new DialogInterface.OnClickListener()
{
//添加一个 PositiveButton按钮并指定其单击事件
@Override
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
{
//添加一个NegativeButton按钮并指定其单击事件
@Override
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
});
builder.create(); 显示该AlertDialog
//申明一个 LayoutInflater
View view = fInflater.inflate(R.layout.app_header, (ViewGroup)findViewById(R.id.lay_dialog));
// R.layout.app_header 找到其所在的layout文件,
//指定确切的View
AlertDialog.Builder builder = new Builder(MainActivity.this);
//新建一个AlertDialog 并指定它所在的context
builder.setMessage("确定退出吗");
//设置其提示内容
builder.setTitle("温馨提示");
//设置其标题
builder.setPositiveButton("确定", new DialogInterface.OnClickListener()
{
//添加一个 PositiveButton按钮并指定其单击事件
@Override
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
{
//添加一个NegativeButton按钮并指定其单击事件
@Override
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
});
builder.create(); 显示该AlertDialog