android:digits Problem

Posted by user244190 on Stack Overflow See other posts from Stack Overflow or by user244190
Published on 2010-05-26T23:07:35Z Indexed on 2010/05/26 23:11 UTC
Read the original article Hit count: 421

Filed under:

I am using the following xml to limit input to digits only in an EditText widget. The android:digits attribute uses the below array resource. Everything works great except for the fact that I can't enter the number 4 even though its in the array. Any Ideas?

<EditText
                                    android:id="@+id/mynumber"  
                                    android:layout_width="wrap_content" 
                                    android:layout_height="wrap_content"
                                    android:textSize="40dp"
                                    android:textStyle="bold"
                                    android:gravity="center_horizontal"
                                    android:layout_centerHorizontal="true"
                                    android:textColor="#aaffaa"
                                    android:numeric="integer"
                                    android:digits="@array/digits"
                                    android:background="#00000000"
                                    android:inputType="phone"
                                    android:focusable="true"
                                    android:singleLine="true"
                                    />

     <string-array name="digits">
    <item>0</item>
    <item>1</item>
    <item>2</item>
    <item>3</item>
    <item>4</item>
    <item>5</item>
    <item>6</item>
    <item>7</item>
    <item>8</item>
    <item>9</item>
 </string-array>

Thanks

© Stack Overflow or respective owner

Related posts about android