80,337
社区成员
发帖
与我相关
我的任务
分享
public static Bitmap takeScreenShot(Activity pActivity,int heightValue)
{
Bitmap bitmap=null;
View view=pActivity.getWindow().getDecorView();
view.destroyDrawingCache();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap b1=view.getDrawingCache();
Rect frame=new Rect();
view.getWindowVisibleDisplayFrame(frame);
int x=(pActivity.getWindowManager().getDefaultDisplay().getWidth()-Utils.dip2px(200))/2;
int y=Utils.dip2px(frame.top+56+90);
int width=Utils.dip2px(200);
int height=Utils.dip2px(heightValue);
bitmap=Bitmap.createBitmap(b1, x, y, width, height);
Log.d("add3", String.valueOf(bitmap));
return bitmap;
}