[英]capture screen shot programmatically in android
I have gridview and show image. 我有gridview并显示图像。 Every image click show the list activity as dialog based on same position.
每次单击图像都会基于相同位置将列表活动显示为对话框。 when i click back button capture screen on list activity.
当我单击列表活动上的后退按钮捕获屏幕时。 how can i do?
我能怎么做?
Here this sample to work but not capture list activity as dialog activity. 在这里,此示例可以工作,但不能将列表活动捕获为对话框活动。 Thanks for advanced
感谢高级
View v1 =getWindow().getDecorView().getRootView();
v1.setDrawingCacheEnabled(true);
Bitmap bm = v1.getDrawingCache();
BitmapDrawable bitmapDrawable = new BitmapDrawable(bm);
holder.cardBack.setBackgroundDrawable(bitmapDrawable);
// holder.cardBack.setBackgroundResource(R.drawable.a);
holder.rootLayout.startAnimation(flipAnimation);
try this, Call this method, passing in the outer most ViewGroup that you want a screen shot of: 尝试此操作,调用此方法,传入要截屏的最外面的ViewGroup:
public Bitmap screenShot(View view) {
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),
view.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);
return bitmap;
}
Ref : How to programmatically take a screenshot in Android? 参考: 如何在Android中以编程方式拍摄屏幕截图?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.