将ImageView的设置的图片置空

2018-08-01  本文已影响334人  topone37
 * 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)

上一篇 下一篇

猜你喜欢

热点阅读