Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何验证编辑文本以允许用户在 android 中输入价格的整数和浮点值
谢谢
在 XML 中向 editText 添加属性:android:inputType="number|numberSigned|numberDecimal"用于有符号浮点数。
android:inputType="number|numberSigned|numberDecimal"
使用 EditText 的 inputtype:
android:inputType="number|numberDecimal"