我想将位图颜色设置为src。但是我的颜色没有显示,只有空屏。我试着去做
mIcon11 = BitmapFactory.decodeResource(getResources(), R.color.grey);如果我写R.drawable.imageName,它会显示图像,为什么我的颜色不显示?
我的颜色是:
<resources>
<color name="grey">#696969</color>
</resources>发布于 2013-03-05 05:18:11
作为Bitmap
int bitmapWidth = ...
int bitmapHeight = ....
Bitmap mIcon11 = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
mIcon11.eraseColor(getResources().getColor(R.color.grey));。
因为它是一种颜色,所以您并不真正需要Bitmap。将其作为Drawable加载可能更好
Drawable mIcon11 = getResources().getDrawable(R.color.grey);发布于 2013-03-05 01:05:32
你可以参考这个:how to get RGB values of bitmap in android
或
http://www.java2s.com/Code/Android/2D-Graphics/Findcomponentsofcolorofthebitmapatxy.htm
他们提到了如何获得位图颜色
https://stackoverflow.com/questions/15206697
复制相似问题