1. 程式人生 > >android螢幕截圖,android怎麼擷取整個螢幕

android螢幕截圖,android怎麼擷取整個螢幕

View view= getWindow().getDecorView();
int width = getResources().getDisplayMetrics().widthPixels ;
int height = getResources().getDisplayMetrics().heightPixels ;
Bitmap bmp = Bitmap. createBitmap(width, height, Bitmap.Config.ARGB_8888 );
Canvas canvas = new Canvas(bmp);
view.draw(canvas);