In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use EditText to prohibit the input of facial expressions in Android". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use EditText to prohibit the input of facial expressions in Android.
The code is as follows
InputFilter inputFilter= new InputFilter () {Pattern emoji = Pattern.compile ("[\ ud83c\ udc00-\ ud83c\ udfff] | [\ ud83d\ udc00-\ ud83d\ udfff] | [\ u2600 -\ u27ff]", Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE); @ Override public CharSequence filter (CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {Matcher emojiMatcher = emoji.matcher (source) If (emojiMatcher.find ()) {/ / Toast.makeText (MainActivity.this, "do not support input emoji", 0). Show (); MyToast.showText ("do not support input emoji"); return ";} return null;}}
Then set filter for editText. Here, two filter are set for editText. The first is to mask facial expressions, and the second is to set the limit on how many words the user can enter.
/ / set filteredit_name.setFilters for editText (new InputFilter [] {inputFilter,new InputFilter.LengthFilter (12)})
Of course, the last thing I would like to remind you here is that such blocked emoticons must not be completely blocked. So in the end, we can only choose to let users fill in English, Chinese characters, and numbers. Here is the code for the filter
InputFilter inputFilter=new InputFilter () {Pattern pattern = Pattern.compile ("[^ a-zA-Z0-9\ u4E00 -\\ u9FA5]"); @ Override public CharSequence filter (CharSequence charSequence, int I, int i1, Spanned spanned, int i2, int i3) {Matcher matcher= pattern.matcher (charSequence); if (! matcher.find ()) {return null;} else {MyToast.showText ("only enter Chinese characters, English, numbers") Return ";}}; at this point, I believe you have a deeper understanding of" how to use EditText to prohibit input facial expressions in Android ". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.