EditTextPreference-仅数值inputType-不起作用 [英] EditTextPreference - only numeric value inputType - isn't working
本文介绍了EditTextPreference-仅数值inputType-不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<android.support.v7.preference.EditTextPreference
android:key="prefTest"
android:title="test number input"
android:inputType="numberDecimal|numberSigned"
android:defaultValue="800"/>
它仍然显示普通键盘,并允许我键入任何字符
It still shows regular keyboard and allows me to type any character
android.support.v7
出问题了吗?
推荐答案
android:digits="0123456789"
在edittext中使用它,因为它仅接受定义的数字.如果无法正常使用,请使用 Android-Support-Preference-V7-Fix 库.
use this in edittext as it accepts only defined numbers. if its not working then use Android-Support-Preference-V7-Fix library.
固定的EditTextPreference会将XML属性(例如inputType)转发到EditText,就像原始首选项一样.
Fixed EditTextPreference forwards the XML attributes (like inputType) to the EditText, just like the original preference did.
这篇关于EditTextPreference-仅数值inputType-不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文