简体   繁体   中英

Android - Numeric (float) soft keyboard

I need to insert in an EditText some numeric data with decimal. I know that i could insert this:

android:inputType="numberDecimal"

in my xml file. But I'd like a different keyboard with only numeric (and point) keys. Something like the "phone" keyboard ( android:inputType="phone" ).

I know, this is a duplicated question ( here the original) but i decided to open a new one because the first one doesn't look to have a good solution.

It depends on keyboard app, which is installed on your device, which buttons are visible for different inputTypes. You can't simply override default keyboard due to security issues. But you can create your own implementation. But it needs to be registered by user in settings.

There is how to do it:
http://android-developers.blogspot.com/2009/04/creating-input-method.html

And sample keyboard:
http://developer.android.com/resources/samples/SoftKeyboard/index.html

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