问题
this is my xml code
<EditText
android:id="@+id/etSPHr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@drawable/myedittext"
android:digits="0123456789.+-"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusForward="@+id/etCYLr"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:singleLine="true" >
the problem is my keyboard doesnt let me use the plus sign its disabled
回答1:
Doing
android:inputType="numberDecimal|numberSigned"
should work.
来源:https://stackoverflow.com/questions/14488060/forcing-edittext-to-only-accept-values-of-numbers-decimals-plus-and-minus-si