How insert number (double) in EditText

Artem picture Artem · Sep 26, 2014 · Viewed 16.5k times · Source

I use this code

 <EditText
     android:id="@+id/price_for_liter_value_edit_text"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:background="@android:color/transparent"
     android:textColor="@color/dn_14_date"
     android:fontFamily="sans-serif-regular"
     android:textSize="18sp"
     android:text=""
     android:padding="4dp"
     android:inputType="number"/>

and at this line I set inputType:

  android:inputType="number"

but I cant enter double number (with . - like as 1.3 or 20.5). What type should I use in inputFormat ?

Answer

Blackbelt picture Blackbelt · Sep 26, 2014

You can use

  android:inputType="numberDecimal"