/** 获得验证码图片 */
  private void getVerifyCodeImg() {
    ImageRequest request =
        new ImageRequest(
            Constant.RequestURL.VERIFY_URL,
            new Response.Listener<Bitmap>() {
              @Override
              public void onResponse(Bitmap bitmap) {

                // 缩放 bitmap
                Matrix matrix = new Matrix();
                matrix.postScale(3f, 3f);
                Bitmap newBitmap =
                    Bitmap.createBitmap(
                        bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);

                // 成功获得验证码图片后显示
                mImgVerifyCode.setImageBitmap(newBitmap);
              }
            },
            0,
            0,
            Bitmap.Config.RGB_565,
            new Response.ErrorListener() {

              @Override
              public void onErrorResponse(VolleyError volleyError) {
                // 图片获取失败提示
                Toast.makeText(LoginActivity.this, "验证码获取失败,请检查网络", Toast.LENGTH_SHORT).show();
              }
            }) {
          // 获得 Cookies
          @Override
          protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
            Map<String, String> responseHeaders = response.headers;
            GlobalVar.cookie = responseHeaders.get("Set-Cookie");
            return super.parseNetworkResponse(response);
          }
        };
    request.setTag("VerifyCodeImage Request");
    MyApplication.getQueues().add(request);
  }
  public void requestImage(final ImageView niv, final String imgUrl) {
    ImageRequest request =
        new ImageRequest(
            imgUrl,
            new Response.Listener<Bitmap>() {
              @Override
              public void onResponse(Bitmap bm) {
                niv.setImageBitmap(bm);
                niv.invalidate();
              }
            },
            0,
            0,
            Bitmap.Config.ARGB_8888,
            new Response.ErrorListener() {
              public void onErrorResponse(VolleyError volleyError) {
                volleyError.printStackTrace();
              }
            });

    request.setTag(Constants.IMAGE_TAG);
    VolleyApp.getRequestQueue().add(request);
  }