小编mar*_*thu的帖子

如何拍摄surfaceview的快照?

我正在Android应用程序中使用H264视频渲染SurfaceView.它有一个功能,可以在表面视图上渲染视频时拍摄快照.每当我拍摄快照时,我只会获得透明/黑屏.我使用getDrawingCache()方法来捕获仅返回空值的屏幕.我使用下面的代码来捕获屏幕.

SurfaceView mSUrfaceView = new SurfaceView(this); //Member variable

if(mSUrfaceView!=null)
  mSUrfaceView.setDrawingCacheEnabled(true); // After video render on surfaceview i enable the drawing cache

Bitmap bm = mSUrfaceView.getDrawingCache(); // return null  
Run Code Online (Sandbox Code Playgroud)

android surfaceview

2
推荐指数
1
解决办法
4723
查看次数

标签 统计

android ×1

surfaceview ×1