我正在开发一个游戏应用程序。但是在修复“X”和“Y”坐标的情况下,在构建绘图缓存的基础上获取背景颜色存在一些问题。
我的代码是这样的..
mainRelativeLayout.buildDrawingCache();
Bitmap bitmap = mainRelativeLayout.getDrawingCache();
int color = bitmap.getPixel(200,320);
Log.e("color", "" + color);
但它在颜色上返回空指针异常。