Configure android EditText to allow decimals and negatives

后端 未结 2 644
陌清茗
陌清茗 2021-02-11 14:37

I have an Android EditText that I want to have the number keyboard come up.

If I set the android:inputType to numberSigned, I get the number keyboard and t

相关标签:
2条回答
  • 2021-02-11 15:21

    We can use,

    edit_text.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
    

    if we need to use programmatically..

    0 讨论(0)
  • 2021-02-11 15:42

    You are just missing this in your EditText,

    android:inputType="numberDecimal|numberSigned"
    
    0 讨论(0)
提交回复
热议问题