表示我也是canvas.drawBitmap(mIconBitmap, null, mIconRect, null)这句报空指针
解决方法:
case R.styleable.ChangeColorIconWithText_icon1 :
BitmapDrawable drawable=(BitmapDrawable) a.getDrawable(attr);这下面加上mIconBitmap = drawable.getBitmap();
解决方法:
case R.styleable.ChangeColorIconWithText_icon1 :
BitmapDrawable drawable=(BitmapDrawable) a.getDrawable(attr);这下面加上mIconBitmap = drawable.getBitmap();
2015-07-15
已采纳回答 / foreverHan
你代码看错了 不是这么写的 在好好看看老师的源码int x = getMeasuredWidth() / 2 - mTextBound.width() / 2; int y = mIconRect.bottom + mTextBound.height();
2015-06-23