常见对话框
>确定取消对话框
AlertDialog.Builder builder = new Builder(Context);
builder.setTitle("警告:");
builder.setMessage("若练此功");
builder.setPositiveButton("确定自宫",new OnclickListener(){
public void onClick(){
}
});
builder.setNegativeButton("",new OnclickListener(){
});
AlertDialog dialog=builder.create();
dialog.show();
>单选对话框
AlertDialog.Builder builder = new Builder(Context);
builder.setTitle("请选择您的性别:");
String[] items={"男","女"}
builder.setSingleChoiceItems(items,-1,new OnclickListener(){
});
builder.setNegativeButton("",null);
builder.show();
>多选对话框
AlertDialog.Builder builder = new Builder(Context);
builder.setTitle("请选择您的爱吃的水果:");
String[] items={"","","",""};
boolean checkedItems=new boolean{true,true,false,flase};
builder.setMultiChoiceItems(items,checkedItems,new OnMultiChoiceClickListener(){
public
checkedItems[which]=ischecked;
});
>进度对话框
PreogressDialog pd=new PreogressDialog(Context);
pd.setTitle();
pd.setMessage();
pd.show();
pd.dismiss();
>进度条对话框
PreogressDialog pd=new PreogressDialog(Context);
pd.setPregressStyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setTitle();
pd.setMessage();
pd.show();
pd.dismiss();