将ImageView的设置的图片置空

 * 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的设置的图片置空)