final AlertDialog.Builder alert = new AlertDialog.Builder(
CloudSyncActivity.this);
alert.setIcon(getResources().getDrawable(R.drawable.about));
alert.setTitle("标题");
alert.setMessage("输入提示信息");
alert.setPositiveButton("确认",
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog,
int which) { //控制点击按钮不消失问题
try
{
Field field = dialog.getClass()
.getSuperclass().getDeclaredField(
"mShowing" );
field.setAccessible( true );
// 将mShowing变量设为false,表示对话框已关闭
field.set(dialog, false );
dialog.dismiss();

}
catch (Exception e)
{

}
//获取按钮对象
Button PositiveButton=((AlertDialog)dialog).getButton(AlertDialog.BUTTON_POSITIVE);
//对按钮进行操作
PositiveButton.setVisibility(View.GONE);

}
});
alert.setNegativeButton("取消",
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog,
int which) {
try
{
Field field = dialog.getClass()
.getSuperclass().getDeclaredField(
"mShowing" );
field.setAccessible( true );
// 将mShowing变量设为false,表示对话框已关闭
field.set(dialog, true );
dialog.dismiss();

}
catch (Exception e)
{

}
}
});
alert.show();