美文网首页
将ImageView的设置的图片置空

将ImageView的设置的图片置空

作者: topone37 | 来源:发表于2018-08-01 11:13 被阅读334次
 * If this view doesn't do any drawing on its own, set this flag to
 * allow further optimizations. By default, this flag is not set on
 * View, but could be set on some View subclasses such as ViewGroup.
 *
 * Typically, if you override {@link #onDraw(android.graphics.Canvas)}
 * you should clear this flag.
 *
 * @param willNotDraw whether or not this View draw on its own
 */
public void setWillNotDraw(boolean willNotDraw) {
    setFlags(willNotDraw ? WILL_NOT_DRAW : 0, DRAW_MASK);
}
   
//清空图片
iv_show.setWillNotDraw(true)
//设置图片
iv_show.setWillNotDraw(false)
iv_show.setImageResoure(R.di.img)

相关文章

网友评论

      本文标题:将ImageView的设置的图片置空

      本文链接:https://www.haomeiwen.com/subject/zhmlvftx.html