首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在尝试为https://github.com/appsthatmatter/GraphView拍摄图形快照时获取IllegalStateException

在尝试为https://github.com/appsthatmatter/GraphView拍摄图形快照时获取IllegalStateException
EN

Stack Overflow用户
提问于 2017-01-29 19:36:12
回答 3查看 1.1K关注 0票数 2

我正在尝试拍摄GraphView的快照,但出现错误"GraphView必须在硬件加速模式下使用“。我使用下面的代码来拍摄快照

代码语言:javascript
复制
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); 
Canvas canvas = new Canvas(bitmap); 
view.draw(canvas);

另外,我已经在应用程序级别设置了android:hardwareAccelerated="true"

EN

Stack Overflow用户

发布于 2018-04-26 17:23:33

在最新版本4.2.2中,快照功能正常运行。您可以查看文档和示例项目:

http://www.android-graphview.org/take-snapshots/

这基本上是API调用:

代码语言:javascript
复制
// directly share it
graph.takeSnapshotAndShare(mActivity, "exampleGraph", "GraphViewSnapshot");

// get the bitmap
Bitmap bitmap = graph.takeSnapshot();
票数 0
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41920458

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档