1.
Context context = register.this;
//设置标题
String title = "EMO漂流瓶账号注册";
//设置显示信息
String message = "确定注册漂流瓶账号吗?";
//设置第一个按钮显示文本
String button1String = "确定";
//设置第二个按钮显示文本
String button2String = "取消";
AlertDialog.Builder ad = new AlertDialog.Builder(context);
ad.setTitle(title);
ad.setMessage(message);
ad.setPositiveButton(button1String, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
ad.setNegativeButton(button2String, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
ad.show();
}
2.提示后,过一会会自动消失。
Toast.makeText(register.this, "注册成功!", Toast.LENGTH_LONG).show();
3.Dialog-Themed-Activities
<activity android:name=".register"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog"/>
4.输入方式对话框
DatePickerDialog,TimePickerDialog,ProgressDiaolog