我正在尝试拍摄 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"
。
最佳答案
我用过这个:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/GraphView-4.0.1.jar')
compile 'com.jjoe64:graphview:4.1.0'
}
特别是
compile 'com.jjoe64:graphview:4.1.0'
这对我有帮助。
关于android - 尝试拍摄 https ://github. com/appsthatmatter/GraphView 的图表快照时出现 IllegalStateException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41920458/