简体   繁体   English

EditText android:numeric =“decimal”和android:inputType =“numberDecimal”之间的区别

[英]Difference among EditText android:numeric=“decimal” and android:inputType=“numberDecimal”

I was wondering, what is the difference among the 2? 我在想,2之间有什么区别?

        <EditText                
            android:inputType="numberDecimal" />

        <EditText                
            android:numeric="decimal" />

I realize both gives same behavior. 我意识到两者都有同样的行为。 They limit the user input to " 0123456789. " 它们将用户输入限制为“ 0123456789 ”。

So, is there any differences among the 2? 那么,2之间有什么不同吗? Is there any preferable? 有没有更好的?

All of these attributes are deprecated: 不推荐使用所有这些属性:

android:numeric
android:phoneNumber
android:inputMethod
android:capitalize
android:autoText

in favor of one attribute: 赞成一个属性:

android:inputType

(Remember deprecated features will disappear someday in a future release, so it is always best to use the supported version.) (请记住,在将来的版本中,不推荐使用的功能将在某一天消失,因此最好使用支持的版本。)


For whatever reason their deprecation is not marked in the TextView (or EditText) documentation... However they are properly annotated on the R.attr page and presumably you will see the warnings inside your IDE's XML compiler (at least in Android's Eclipse plug-in.) 无论出于何种原因,他们的弃用没有标记在TextView(或EditText)文档中......但是它们在R.attr页面上被正确注释,并且可能你会在IDE的XML编译器中看到警告(至少在Android的Eclipse插件中)在。)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android EditText inputType =“ numberDecimal”仅在第二次点击时显示正确的键盘 - Android EditText inputType=“numberDecimal” only shows correct keyboard on second tap 带有inputType numberDecimal的Android EditText字段设置默认值 - Android EditText field with inputType numberDecimal set default value 十进制分隔符逗号 (&#39;,&#39;) 与 EditText 中的 numberDecimal inputType - Decimal separator comma (',') with numberDecimal inputType in EditText android:inputType =“numberDecimal”与InputType.TYPE_NUMBER_FLAG_DECIMAL - android:inputType=“numberDecimal” vs. InputType.TYPE_NUMBER_FLAG_DECIMAL Android EditText InputType,数字键盘+附加文本 - Android EditText InputType, numeric keyboard + append text 无法使用EditText inputType =“ number” Android添加小数 - Unable to add decimal with EditText inputType=“number” Android Android EditText,减去转换为点事件,虽然inputType =“number | numberSigned | numberDecimal” - Android EditText, minus converted into a dot event though inputType=“number|numberSigned|numberDecimal” 当EditText View的android:inputType设置为“ numberDecimal”时,接受来自SIP的数字和字母输入 - Accept number and letter input from SIP when android:inputType of EditText View set to “numberDecimal” 输入类型为numberDecimal的EditText有下划线 - EditText with inputType numberDecimal has underlines 使用InputType:numberDecimal的EditText中的可能验证 - Possible validations in EditText with inputType:numberDecimal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM