I’m implementing a form where the user is asked for a measurement. Depending on the locale, the user will be entering either meters or feet/inches.
Naively, my current implementation asks for a decimal point to be used with only feet. e.g., 2.5 feet would equal 2′ 6″ which is fairly misleading from my understanding. I’m not in a country that hasn’t adopted to the metric system, so it wasn’t obvious to me at the time.
There’s a few possibilities and problems I see:
- Show two
EditTextfields, one for feet one for inches. This makes layout design difficult since I’m also allowing the user to enter meters, which will only need oneEditText. A possibility is to make one hidden at run time. - Using one
EditText, I can’t seem to find anandroid:inputTypethat allows for number input plus double primes and primes, or double quotes and apostrophes. e.g. 3′ 5″ or 3′ 5″. It means theEditTextwould have to use the standard alphabet keyboard which makes it slightly hindering to the user. - Also, with one
EditText, I am happy to (and already doing so for just a single entry with meters and feet without inches), to suffix theEditTextafter the user loses focus, and remove the suffix when being focused again. This does make the code more complex for a simple input field.
Are there any other options for this?
I just realised soon after posting:
Why not create a
NumberPickerpopup orSpinnerwhen the user focuses on theEditText. This would only show up for imperial measurements.