简体   繁体   中英

Soft Keyboard Input

I have a problem with the soft keyboard input. I have a EditText field where I need the user to input a dollar amount. Naturally, I specified android:inputType="number" in the main.xml for the EditText . But then the user can't enter the decimal point even though the key is there on the keyboard. In other words, the user can only enter integers but not decimal numbers. I would like my users to be able to enter decimal numbers so what should I do?

Use this instead:

android:inputType="numberDecimal"

This allows you to also put in the decimal point, for things like currencies and percentages, giving you what you want.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM