我可以在 XML 中设置 InputType
'time'
<EditText
android:inputType="time"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
我需要一个键盘,它可以显示 digits
和 colon(:)
。如何以编程方式设置 InputType
“时间”?
最佳答案
对于 time
字段:
setInputType(InputType.TYPE_CLASS_DATETIME |InputType.TYPE_DATETIME_VARIATION_TIME);
datetime has dot(.), slash(/) which I do not want to show in keyboard
你应该试试
setKeyListener(DigitsKeyListener.getInstance("0123456789:"));
关于android - 如何以编程方式设置 InputType 'time'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46537822/