Can anyone tell me how to make an EditText
not editable via XML? I tried setting android:editable
to false
, but
- it is deprecated; and
- it didn't work.
Can anyone tell me how to make an EditText
not editable via XML? I tried setting android:editable
to false
, but
When I want an activity to not focus on the EditText and also not show keyboard when clicked, this is what worked for me.
Adding attributes to the main layout
and then the EditText field
Here is an example:
Try this :
This combination worked for me:
I've tried the following:
but the problem was that if the edit text is the first in the form then it gets the focus and the pickCode() code which launches a new activity is called straight away. So I modified the code as follows and it seems to work quite well (except I cannot set the focus on the text edit but I don't need to):
Best Regards,
Comments welcome,
John Goche
In addition to @mahe madi you can try this as well
This method will hide cursor, lose focus and more importantly set text color to black behaving like TextView.
And to revert Back to editText simply do this to gain all the properties of EditText.
Hope it Helps :)
Use this simple code:
It works.
Edit : To add
KeyListener
later, do following1 : set key listener to tag of
textView
2 : get key listener from tag and set it back to
textView