EditText輸入校驗和一些相關的屬性

2021-06-07 05:55:58 字數 900 閱讀 4592

edittext輸入校驗,需要對%,_,#這些符號進行限制輸入,我是直接通過edittext的addtextchangedlistener方法來設定監聽的:
private final textwatcher mtextwatcher = new textwatcher()  

public void ontextchanged(charsequence s, int start, int before, int count)

public void aftertextchanged(editable s) }}

};

通過設定android:imeoptions來改變軟體盤中的部分按鍵顯示:

actionunspecified  未指定,對應常量editorinfo.ime_action_unspecified.效果:

actionnone 沒有動作,對應常量editorinfo.ime_action_none 效果:

actiongo 去往,對應常量editorinfo.ime_action_go 效果:

actionsearch 搜尋,對應常量editorinfo.ime_action_search 效果:

actionsend 傳送,對應常量editorinfo.ime_action_send 效果:

actionnext 下乙個,對應常量editorinfo.ime_action_next 效果:

actiondone 完成,對應常量editorinfo.ime_action_done 效果:

暫時還不知道怎麼控制軟體不顯示那些符號的按鍵的鍵盤,我通過設定了inputtype屬性 android:inputtype="textpersonname"但還是沒有效果

參考2:

EditText實現輸入限制和校驗

一 方法 1 輸入限制 1 通過android digits限制只能輸入小寫abc android digits abc 2 通過android inputtype限制只能輸入數字 android inputtype number 在android inputtype中可以設定各種限制,比如郵箱位址...

EditText的一些使用技巧

1.讓edittext不自動獲取焦點 將edittext的某個父級控制項設定成 android focusable true android focusableintouchmode true 2.改變軟鍵盤右下角確認鍵 設定edittext控制項的imeoptions屬性 edittext and...

關於EditText的輸入數字校驗的問題

一.簡述需求 1.需求是輸入數字是刪除第一位數字后位是0的禁止刪除 如支付寶 2.需求是可以刪除任何位置的數字。如果刪除第一位後面是0,就去掉無效的0 二.具體的實際例子如 1010需求1來做 刪除第一位是禁止刪除 1010需求2來做 刪除第一位變成10 三.下面具體上 方式一private voi...