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

后端 未结 2 907
无人及你
无人及你 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: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);
    

提交回复
热议问题