問題描述
我在 EditText 字段中設置了最大文本長度.
I set up a max length of text in an EditText field.
<EditText
android:id="@+id/courseDescriptionField"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="5"
android:maxLength="@integer/max_course_description_limit"
android:gravity="left|top" >
</EditText>
然而,對我來說問題是,文本在 140 個字符之后出現,但它仍然繼續輸入,除了文本沒有出現,但是,它確實出現在緩沖區"中(意思是建議事情)如果這就是你所說的.
The problem for me however is, that, text STOPS appearing after 140 characters, but it still continues to type, except that text just doesn't appear, but however, it does appear in the "buffer" (meaning the suggestion thing) if that's what you would call it.
附帶說明,我正在使用 TextWatcher 來跟蹤限制.有沒有辦法完全限制文本的數量,這樣當有 140 個字符時,按下退格/刪除以外的東西時什么都不會發生?
As a side note, I am using a TextWatcher to keep track of the limit. Is there any way to completely limit the amount of text, so that when there are 140 characters, nothing happens when something other than backspace/delete is pressed?
推薦答案
限制Android中EditText的文本長度
使用 android:maxLength="140"
應該可以.:)
希望有幫助
這篇關于Android EditText 最大長度的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!