0

I want to restrict a user can enter only positive and negative real value in edit text. Here is my code

 <EditText
        android:id="@+id/value"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:hint="@string/value"
        android:inputType="numberDecimal"
    >

By above code i am able to enter real value But can't enter negative real value(like "-3.7") how it is possible. Is there any other property for this.

Thanks in advance.

Jeetu
  • 686
  • 2
  • 10
  • 20

1 Answers1

4

There is another attribute numberSigned which can be combined with numberDecimal as numberDecimal|numberSigned.

This is a duplicate of the following: Android InputType layout parameter - how to allow negative decimals?

The Android documentation is here: http://developer.android.com/reference/android/text/InputType.html#TYPE_NUMBER_FLAG_SIGNED

Community
  • 1
  • 1
Jackson Kulik
  • 308
  • 2
  • 10