android - How to take screenshot for scroll view ? -


How to take a screenshot for a specific layout

This code takes screenshots for activity without the status bar I want to take a screen for scroll view

  view view = matching (). GetDecorView (); View.setDrawingCacheEnabled (true); View.buildDrawingCache (true); Bitmap b1 = view.gradingcash (); Rect Frame = New Rect (); . This.getWindow () getDecorView () getWindowVisibleDisplayFrame (frame). Int Position BarHeight = frame.top; Int width = this.getWindowManager (). GetDefaultDisplay () GetWidth (); Int height = this.getWindowManager (). GetDefaultDisplay () .getHeight (); Bitmap bm = bitmap Bitmap (B1, 0, status barough, width, height - position barough);   

I want to take a screenshot for scroll view - I have searched a lot here but I do not know anything that anyone can help

Are you able to take screenshots with the title bar?

Then get title bar height using this

  performance metric = new performance metrics (); . GetWindowManager () getDefaultDisplay () getMetrics (matrix). Int myHeight = 0; Switch (Metrics Density Dpi) {case DisplayMetrics.DENSITY_HIGH: Log. I ("display", "high"); MyHeight = display.getHeight () - 48; break; Case Display Metals DENSITY_MEDIUM: Logs. I ("display", "medium / default"); MyHeight = display.getHeight () - 32; break; Case Display Metals DENSITY_LOW: log. ("Display", "less"); MyHeight = display.getHeight () - 24; break; Default: Log. I ("display", "unknown density");   

Now change your code

  int height = this.getWindowManager (). GetDefaultDisplay () .getHeight ();   

with

  int height = this.getWindowManager (). GetDefaultDisplay () .getHyight () - THE_HEIGHT_OF_NOTIFICATION_BAR;   

I tried my own but it seems to me that if it is removed from the image above or below and we find out what happens, then it will work ...

thx

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -