edittext visible means how can i check the if condition in android

前端 未结 2 1156
耶瑟儿~
耶瑟儿~ 2021-01-21 15:34

I have checked my edittext is visible or invisible in android.

Now i have to check the condition is.,

  1. If my edittext is visible means how can i insert the d
相关标签:
2条回答
  • 2021-01-21 15:47

    use

    if(Saddress.getVisibility() == View.VISIBLE){
      //.. your code here
    }
    

    instead of

    if(Saddress== VISIBLE){
    //.. your code here
    }
    

    because VISIBLE,GONE and INVISIBLE is part of View class instead of Activity

    0 讨论(0)
  • 2021-01-21 15:48
    EditText editText = (EditText)findViewById(R.id.editText1);
    editText.getVisibility();
    

    this will provide the edittext is VISIBLE, INVISIBLE, or GONE.

    if(editText.getVisibility() == View.VISIBLE){
       //.. your actions are performed here
    }
    

    Refer This. You can find some interesting details about VISIBLE ,GONE and INVISIBLE

    0 讨论(0)
提交回复
热议问题