Perceptual knowledge:
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/06453V521-0.gif "title =" MOV_0141_clip.gif "/>
For more information, see notes:
@ Overridepublic void onClick (View v) {switch (v. getId () {case R. id. about_me: // obtain the screen View targetView = mActivity. getWindow (). getDecorView (); targetView. setSystemUiVisibility (View. SYSTEM_UI_FLAG_FULLSCREEN); // capture the full screen targetView. setDrawingCacheEnabled (true); Bitmap fullBitmap = Bitmap. createBitmap (targetView. getDrawingCache ();/** get the status bar height Rect frame = new Rect (); mActivity. getWindow (). getDecorView (). ge TWindowVisibleDisplayFrame (frame); int statusBarHeight = frame. top; */DisplayMetrics dm = mActivity. getResources (). getDisplayMetrics ();/** remove the title bar Bitmap bitmap = Bitmap. createBitmap (fullBitmap, 0, statusBarHeight, dm. widthPixels, dm. heightPixels-statusBarHeight); targetView. destroyDrawingCache (); */OutputStream output = null; try {if (Environment. getExternalStorageState (). equals (Environment. MED IA_MOUNTED) {String sdPath = Environment. getExternalStorageDirectory (). getPath (); // SD card path String pngPath = sdPath + "/Remind/"; // storage path File pngDir = new File (pngPath); if (! PngDir. exists () {pngDir. mkdir (); // make path} String pngName = pngPath + System. currentTimeMillis () + ". png "; output = new FileOutputStream (pngName); if (output! = Null) {fullBitmap. compress (Bitmap. compressFormat. PNG, 100, output); // 100% HD large image output. flush (); output. close ();}/** WindowManager */LayoutInflater inflater = LayoutInflater. from (mActivity); screenShot = inflater. inflate (R. layout. screen_shot, null); wmManager = (WindowManager) mActivity. getSystemService (mActivity. WINDOW_SERVICE); WindowManager. layoutParams wmParams = new WindowManager. layoutParam S (); ImageView shotImg = (ImageView) screenShot. findViewById (R. id. screen_shot_img); shotImg. setImageBitmap (targetView. getDrawingCache ();/*** The following are WindowManager. layoutParams attributes */wmParams. type = WindowManager. layoutParams. TYPE_PRIORITY_PHONE; // here is the key wmParams. format = PixelFormat. RGBA_8888; wmParams. flags = WindowManager. layoutParams. FLAG_NOT_FOCUSABLE | WindowManager. layoutParams. FLAG_NOT_TOUCH_MODA L; wmParams. alpha = 0.8f; // transparency // WindowManager position wmParams. width = dm. widthPixels * 1/2; wmParams. height = dm. heightPixels * 1/2; wmParams. x = dm. widthPixels * 1/2; wmParams. y =-(dm. heightPixels * 1/5); // Add View wmManager. addView (screenShot, wmParams); isRemoved = false; // timer Timer = new timer (); // click the image to disappear. ShotImg. setOnClickListener (new OnClickListener () {@ Override public void onClick (View arg0) {if (wmManager! = Null &&! IsRemoved) {wmManager. removeView (screenShot); isRemoved = true; if (timer! = Null) {timer. cancel () ;}}}); // scheduled task, automatically disappears 3 seconds later. Timer. schedule (new TimerTask () {@ Override public void run () {if (wmManager! = Null &&! IsRemoved) {wmManager. removeView (screenShot); isRemoved = true ;}}, 3000) ;}} catch (Exception e) {e. printStackTrace ();} break; default: break ;}}
This article from the "wIsper technology into art" blog, please be sure to keep this source http://lichen.blog.51cto.com/697816/1218567