Monday, February 1, 2010

Android Numeric Soft Keyboard

I recently spent some time trying to figure out how get the Soft Keyboard to default to numeric input when I only required numbers entering. It’s actually quite simple but took awhile to figure out. All you have to do is add the ‘android:inputType’ to the EditText resource element. You can then add numberDecimal for numbers with decimal places or number if no decimal places are required.


<EditText
android:text=""
android:id="@+id/editReading"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal">
</EditText>

No comments:

Post a Comment