简体   繁体   中英

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

I was wondering, what is the difference among the 2?

        <EditText                
            android:inputType="numberDecimal" />

        <EditText                
            android:numeric="decimal" />

I realize both gives same behavior. They limit the user input to " 0123456789. "

So, is there any differences among the 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.)

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