I have some EditText for mobile number input. App must add unique text for every country. For example for Armenia is must add +374
, and user must fill other numbers. Also +374
must be unchangeable, user can't change or remove it. So is there some kind of ways for doing this?
EDIT:
I don't want to use textView or another view with this text and put it left of the ediText. I want to find some way with less operations. I need text to be frozen not to check every text changes or add missing text when user will delete some part of it.
you can create class extend AppCompatEditText or EditText.
for use:
Create a custom drawable class that will help to convert text into drawable.
Then set the drawable to left of the edittext as
Where the edittext is defined in the layout file as
Final Output looks like
Use Text watcher and when user enters +3 it completes with +374 and it compares the first four characters and if it is same disable the back press of the softkeyboard so that it will not change the text and enters the other digit which append for the text used from the textwatcher