Android - White space below statusbar in screenshot -


i'm using part of code somewhere around :

private static bitmap getscreenshot(view v) {     bitmap b = bitmap.createbitmap(v.getwidth(), v.getheight(), bitmap.config.argb_8888);     canvas c = new canvas(b);     v.draw(c);     /*v.setdrawingcacheenabled(true);     bitmap bitmap = bitmap.createbitmap(v.getdrawingcache());     v.setdrawingcacheenabled(false);*/     return b; } 

to screenshot of view. how activity's view : getwindow().getdecorview().getrootview()

everytime that, gets whole screen, white space of statusbar's height above toolbar. i'm @ lost here, please ask me info should've provided haven't.

edit : forgot, use in conjunction of blurring :

public static bitmap blur(context ctx, bitmap image) {     final float bitmap_scale = 0.4f;     final float blur_radius = 7.5f;     int width = math.round(image.getwidth() * bitmap_scale);     int height = math.round(image.getheight() * bitmap_scale);      bitmap inputbitmap = bitmap.createscaledbitmap(image, width, height, false);     bitmap outputbitmap = bitmap.createbitmap(inputbitmap);      renderscript rs = renderscript.create(ctx);     scriptintrinsicblur theintrinsic = scriptintrinsicblur.create(rs, element.u8_4(rs));     allocation tmpin = allocation.createfrombitmap(rs, inputbitmap);     allocation tmpout = allocation.createfrombitmap(rs, outputbitmap);     theintrinsic.setradius(blur_radius);     theintrinsic.setinput(tmpin);     theintrinsic.foreach(tmpout);     tmpout.copyto(outputbitmap);      return outputbitmap; } 

and method called in activity :

public static bitmap blur(view v) {     return blur(v.getcontext(), getscreenshot(v)); } 

here's ss of window

blank white space on top

just update java code per below

displaymetrics dm = new displaymetrics();         ((activity) this.getcontext()).getwindowmanager().getdefaultdisplay().getmetrics(dm);      android.view.viewgroup.layoutparams params = layout.getlayoutparams();     int width = params.width;     int height = params.height;      rect rectangle = new rect();     window window = ((activity) ratioimagead.this.getcontext()).getwindow();     window.getdecorview().getwindowvisibledisplayframe(rectangle);      float imageproportion = (float) width / (float) height;     // width of screen     int screenwidth = dm.widthpixels;     int screenheight = window.findviewbyid(window.id_android_content).getheight() - window.findviewbyid(window.id_android_content).getpaddingtop();     float screenproportion = (float) screenwidth / (float) screenheight;      if (imageproportion > screenproportion) {         params.width = screenwidth;         params.height = (int) ((float) screenwidth / imageproportion);     } else {         params.width = (int) (imageproportion * (float) screenheight);         params.height = screenheight;     }     layout.setlayoutparams(params); } 

and pass layout view in function


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -