Edittext want to go enable from disable after select the particular item in the spinner items

后端 未结 2 904
无人及你
无人及你 2021-02-10 20:53

I\'m using Spinner,EditText and Button in one page.The spinner has these items ...

Following:

 String[] Items = {
            \"Alarm\",
            \"O         


        
相关标签:
2条回答
  • 2021-02-10 21:23

    I assume that you get the value from the Spinner.

    After getting the value using condition u set the edittext enabled or disabled through this code:

      EditText.setEnabled(BooleanValue);
    

    true is default value and false set the edittext disabled.

    0 讨论(0)
  • 2021-02-10 21:30

    Do this,

        EditText edit = (EditText) findViewById(R.id.EditText01);
        edit.setEnabled(false);
        edit.setInputType(InputType.TYPE_NULL);
        edit.setFocusable(false);
    

    And when any other option selected do this,

        edit.setEnabled(true);
        edit.setInputType(InputType.TYPE_CLASS_TEXT);
        edit.setFocusable(true);
    
    0 讨论(0)
提交回复
热议问题