3

Eclipse 给我一个非常奇怪的错误:方法 getColor() 未定义 ColorDrawable 类型

android.graphics.drawable.ColorDrawable dd = 
   new android.graphics.drawable.ColorDrawable();
dd.getColor();

我不知道如何解决它。所有其他方法都存在。什么?

4

2 回答 2

3

您的目标 API 级别是多少?ColorDrawable.getColor() 是在 API 级别 11 中引入的,因此如果您的目标是较低的 API 级别,您将无法访问该函数。

于 2012-04-19T19:18:42.637 回答
0

为什么不将 Drawable 绘制到一个很小的屏幕外Bitmap中,然后调用getPixel来检索您绘制的颜色?

于 2012-04-22T10:06:02.683 回答