alertDialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("haha")
.setMessage("nihaoma")
.setNegativeButton("cacel", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
System.out.println("cacel");
}
})
.setPositiveButton("confirm", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
System.out.println("confirm");
}
}).show();
DatePickerDialog
DatePickerDialog dialog = new DatePickerDialog(MainActivity.this, new OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
// TODO Auto-generated method stub
}
}, 2017, 2, 12);
dialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "xainshi", 0).show();
}
});
dialog.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "dismiss", 0).show();
}
});
dialog.show();
ProgressDialog
有2种样式
STYLE_HORIZONTAL:
![TG`XY]DYOZRC55%0QALGCE4.png](http://upload-images.jianshu.io/upload_images/935738-7653870c28276ba4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
ProgressDialog d = new ProgressDialog(this);
d.setProgressStyle(1);
d.show();
STYLE_SPINNER 默认的
ProgressDialog.show(this, "你好吗", "howareyour?");
TimePickerDialog
TimePickerDialog p = new TimePickerDialog(this,new OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// TODO Auto-generated method stub
}
},13,20,true);
p.show();