在4.0.4 r1.2中查看android.widget.ImageView源代码可以发现,setImageBitmap()方法其实是调用了setImageDrawable()方法进行重绘。


Sets a Bitmap as the content of this ImageView.Parameters:bm The bitmap to set@android.view.RemotableViewMethodpublic void setImageBitmap(Bitmap bm) {// if this is used frequently, may handle bitmaps explicitly// to reduce the intermediate drawable objectsetImageDrawable(new BitmapDrawable(mContext.getResources(), bm));}


Sets a drawable as the content of this ImageView.Parameters:drawable The drawable to setpublic void setImageDrawable(Drawable drawable) {if (mDrawable != drawable) {mResource = 0;mUri = null;int oldWidth = mDrawableWidth;int oldHeight = mDrawableHeight;updateDrawable(drawable);if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeigh{requestLayout();}invalidate();}}


更多相关文章

  1. Anfdroid网络编程方法
  2. Android:解决列表滚动时背景色变黑的方法
  3. Android 发送短信 源代码
  4. 把android平板USB上输出LOG方法
  5. Windows下Android开发环境配置的一种方法
  6. Android Studio 3.0找不到Android Device Monitor的解决方法
  7. android 5.1 usb调试默认关闭设置方法
  8. Android--ListView滑动时出现黑屏解决方法(整合)
  9. Android不错的图片压缩方法

随机推荐

  1. 《全套Java、Android视频教程》
  2. Android(安卓)Studio插件-Android(安卓)B
  3. Android多线程(二)消息处理机制---Handler
  4. 为什么每个Android开发者都应该使用Anko
  5. android中Http类的封装
  6. Android(安卓)Paint之shader(图像渲染)
  7. Android(安卓)退出程序的若干方法总结
  8. Android开源项目分类汇总(七)优秀项目
  9. Android在代码中设置控件的drawableLeft
  10. flutter methodchannel调用原生方法,实现