public class NewAlertDialog{    public AlertDialog.Builder builder;    public AlertDialog alertDialog;    public ProgressDialog progressDialog;    private Context context;    public NewAlertDialog(Conetxt context){        setContext(context);        builder = new AlertDialog.Builder(context,R.style.xxx);    }    public void setContext(Context context){        this.context = context;    }    public void getContext(){        return context;    }    //创建带左右按钮的对话框    public void makeAlertDialog(String title ,String message,String leftButtonText,String rightButtonText,DialogInterface.OnClickListener enterListener,DialogInterface.OnClickListener cancleListener)        builder.setTitle(title);        .setMessage(message);        .setPositiveButton(rightButtonText,enterListener)        .setNegativeButton(leftButtonText,cancelListener)        ;        alertDialog=builder.show();    }    //dialog呈现无标题列表    public void makeAlertDialogForListItem(String title,String items[],DialogInterface.OnClickListener listener){        builder.setTitle(title)                .setItems(items.listener)        builder.create;    }    //dialog呈现EditText    public void makeAlertDialogForTextView(String title ,View view,String leftButtonText,String rightButtonText,DialogInterface.OnClickListener enterListener,DialogInterface.OnClickListener cancleListener){        builder.setTitle(title)                .setView(view)                .setPositiveButton(rightButtonText,enterListener)                .setNegativeButton(leftButtonText,cancleListener)        alertDialog = builder.show();    }   //创建只带中间按钮的对话框    public void makeNeutralAlertDialog(String title,String message,String buttonText,DialogInterface.OnclickListener enterListener){        builder.setTitle(Title)                .setMessage(message)                .setPositiveButton(buttonText,enterListener)                .create();        alertDialog = builder.show();        alertDialog.setCancleButton(false);        alsetDialog.setCancledOnTouchOutSide(false);//点击非Dialog区域不会关闭对话框        }    //创建带ProgressBar的可以按返回键取消的Dialog    public void makeProgressDialog(String title,Stirng message,DialogInteerface.OnclickListener onKeyListener,boolean canClose){        progressDialog = ProgressDialog.show(context,title,message);        progressDialog.setOnKeyListener(onKeyListener);        progressDialog.setCancleable(canClose);        progressDialog.setCancledOnTouchOutSide(false);        progressDialog.show();    }    ```

更多相关文章

  1. OpenGL学习1
  2. android辅助圆按钮
  3. notification android原生消息通知代码详解
  4. Android(安卓)Context笔记
  5. checkBox判定
  6. Android模拟强制下线通知功能实例代码
  7. android RadioButton单选按钮的使用
  8. Android(安卓)仿苹果自定义Dialog
  9. 使用Kotlin的Android(安卓)Toast

随机推荐

  1. 如何测试从实时网站提取数据的AJAX应用程
  2. Objective-C方法/函数调用。 (来自javascr
  3. Javascript函数的4种调用方法详解
  4. React.js中的setState vs replaceState
  5. 选择无线电输入时,无法提交带有JavaScript
  6. 【JavaScript】中两个小括号 ()() 是什么
  7. jQuery的几大难点
  8. 利用javascript实现遍历xml文件的代码实
  9. 一个html+css+js的轮播图片 -- 仅供参考
  10. 输入自动完成或Rails中的新功能