如何隐藏ProgressDialog后面的最大值进度

来源:互联网 发布:办公用品公司软件 编辑:程序博客网 时间:2024/05/08 14:40

ProgressDialog pg = new ProgressDialog(context) {
      @Override
      public void onAttachedToWindow() {
       getWindow()
         .setType(
           WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
       super.onAttachedToWindow();
      };
     };          

 TextView nullTxt=(TextView)findViewById(R.id.login_textView);

           pg.setMessage("如何隐藏进度栏的最大值");
           pg.setMax(maxProcess);
           pg.show();

           Class<?> cla = ProgressDialog.class;
           try {
                   Field field = cla.getDeclaredField("mProgressNumber");
                   field.setAccessible(true);
                   field.set(pg, nullTxt);
           } catch (Exception e) {
                   e.printStackTrace();
           }