richeditor-android
richeditor-android copied to clipboard
Max length?
How to set max length to editor?
How to set max length to editor?
How to set max length to editor?
richEditor.setOnTextChangeListener(new RichEditor.OnTextChangeListener() { @Override public void onTextChange(String text) { int leng = text.length(); if (leng<=6){ text_count.setText(String.valueOf(leng)); }else{ richEditor.setInputEnabled(false); } } });
richEditor.setOnTextChangeListener(new RichEditor.OnTextChangeListener() { @Override public void onTextChange(String text) { int leng = text.length(); if (leng<=6){ text_count.setText(String.valueOf(leng)); }else{ richEditor.setInputEnabled(false); } } });
richEditor.setInputEnabled(false);
With the above condition, the keyboard got to hide. In this case, we are unable to reopen keyboard again, but how to remove existing characters.
@ram-wavity +
binding.abcd.richEditor.setMaxLength(4005)
fun RichEditor.setMaxLength(maxLength:Int){ this.setOnTextChangeListener { text -> val length = text.length if (length > maxLength) { this.html = text.substring(0, maxLength) this.clearFocusEditor() } } }