1
A
回答
0
你可以在你的XML使用下面的代碼
<EditText
android:inputType="text"
android:digits="0,4,5,6,7,8,9
/>
+0
我會測試它,謝謝 – ibrahimyilmaz
+0
我仍然可以點擊其他按鈕我想看到它們禁用。 – ibrahimyilmaz
0
您可以使用下面的代碼或者在Java方面
private List<Char> allowedChars = new ArrayList(Char);
allowedChars.add(...);
allowedChars.add(...);
allowedChars.add(...);
allowedChars.add(...);
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end,
Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
// Your condition here
if (!allowedChars.contains(source.charAt(i)))) {
return "";
}
}
return null;
}
};
edit.setFilters(new InputFilter[]{filter});
相關問題
- 1. 禁用輸入按鍵輸入按鈕
- 2. 禁用按鈕上的表中的某些輸入按
- 3. 糾正輸入的輸入後重新啓用禁用按鈕
- 4. 使用jquery禁用按鈕,直到輸入已輸入
- 5. React.js:輸入爲空時禁用按鈕
- 6. 爲空輸入禁用發送按鈕
- 7. jbutton.setEnabled(假)不會禁用按鈕輸入
- 8. 禁用按鈕時,在輸入文本
- 9. 禁用與輸入類型=按鈕
- 10. 如何禁用某些輸入字段未填寫的按鈕?
- 11. 後一些edittext輸入自動禁用android中的鍵盤
- 12. 有一些方法可以禁用角2中的一組輸入?
- 13. 統一輸入按鈕
- 14. Android禁用webview輸入
- 15. Android - 用手指檢測輸入按鈕?
- 16. Android - 按鈕被禁用,直到在edittext中輸入一個有效的URL
- 17. 如何在輸入字段中輸入文本之前禁用提交按鈕?
- 18. 輸入鍵盤輸入按鈕
- 19. 輸入提交按鈕並輸入
- 20. 帶輸入類型和輸入按鈕的Android EditText
- 21. 禁止在輸入框中輸入某些字符的腳本
- 22. 我可以在Firefox中模擬輸入按鈕禁用狀態嗎?
- 23. 按下按鈕以輸入文字?
- 24. 輸入不啓用按鈕
- 25. 使用按鈕輸入EditText
- 26. HTML中心輸入按鈕
- 27. 禁止向JTextField輸入一些符號
- 28. 「:輸入」不選擇禁用的輸入
- 29. 禁用提交按鈕,直到輸入字段填入
- 30. 可以輸入
您可以覆蓋與該按鈕的情況下,對於示例[覆蓋後退按鈕](http://stackoverflow.com/questions/3141996/android-how-to-override-the-back-button-so-it-doesnt-finish-my-activity) – user2450263
我該怎麼辦Rride鍵盤輸入類型? – ibrahimyilmaz
1. [處理鍵盤操作](https://developer.android.com/training/keyboard-input/commands.html)和2. [覆蓋Android本機鍵盤](http://stackoverflow.com/questions/17758751/overriding-android-native-keyboard) – user2450263