Textview allowing only numbers

Asked

Viewed 4,002 times

0

I want my TextView only accepted as input numbers, but the line android:numeric="decimal" does not effect, it still allows me to type letters.

1 answer

4


To allow only numbers you must set inside your EditTextin this way :

android:inputType="number"

Another way would be :

<EditText android:id="@+id/myNumber"
 android:digits="0123456789." 
 android:inputType="numberDecimal"/>
  • It didn’t work either

  • How’s your xml? @Daniloalbergardi

  • <Textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Enter Second number" android:inputType="number" />

  • This is inside an editText ? @Daniloalbergardi

  • kkkk puts me sorry, was putting in the text, was in Edit, Thanks!

  • if the answer was satisfactory, mark as right to help other users. @Daniloalbergardi

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.