如何检查图像视图是否有从Android Studio中的图库上传的图像?

问题描述 投票:0回答:1

我已经检查过imageView.getdrrawable()== null,但是imageview已经包含源图像,因此它返回true吗?如何检查?

java android imageview
1个回答
0
投票

使用getDrawable()方法,如果它返回null,则没有分配任何内容

if( mImageView.getDrawable() != null){

    //Image Assigned

    }else{

  //nothing assigned

  }
© www.soinside.com 2019 - 2024. All rights reserved.