我正在尝试拍摄GraphView的快照,但出现错误"GraphView必须在硬件加速模式下使用“。我使用下面的代码来拍摄快照
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);另外,我已经在应用程序级别设置了android:hardwareAccelerated="true"。
发布于 2018-04-26 17:23:33
在最新版本4.2.2中,快照功能正常运行。您可以查看文档和示例项目:
http://www.android-graphview.org/take-snapshots/
这基本上是API调用:
// directly share it
graph.takeSnapshotAndShare(mActivity, "exampleGraph", "GraphViewSnapshot");
// get the bitmap
Bitmap bitmap = graph.takeSnapshot();https://stackoverflow.com/questions/41920458
复制相似问题