如何检查是否ImageView的是空的或不 [英] How can i check if imageview is empty or not

查看:356
本文介绍了如何检查是否ImageView的是空的或不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了形式有一些领域的用户应该填充它的应用程序,我想提出的下一步按钮关​​闭,直到用户填补了这一领域。

字段是:(iamgeView,EditText上,微调..)

我知道如何检查的文本编辑,但我怎么可以检查用户填写的形象和微调与否(图像视图将会让用户选择从本地图库图片)

我想:我怎么能当用户填写的形象和微调或不检查?
这是我的code,检查编辑文本

 私人布尔checkEditText2(编辑的EditText){
    返回edit.getText()长()== 0。
}


解决方案

在XML文件中的图像没有的android:SRC = 机器人:研究背景=

 如果(空!= imgView.getDrawable())
     {
        // ImageView的有图像
     }其他{
       // ImageView的没有图像
     }

i have an application that has form and there is some fields the user should fill it ,i want to put the button "Next" disable until the user fill this fields.

the fields is:(iamgeView, EditText,Spinner..)

i know how to check the text Edit but how can i check if the user fill the image and spinner or not (image view will let the user choose an image from native gallery)

What i want: how can i check if the user fill the image and spinner or not? this is my code to check the Edit Text

  private boolean checkEditText2(EditText edit) {
    return edit.getText().length() == 0;
}

解决方案

In xml file your image have not android:src="" and android:backgroud=""

   if(null!=imgView.getDrawable())
     {
        //imageview have image
     }else{
       //imageview have no image  
     }

这篇关于如何检查是否ImageView的是空的或不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆