<bdo id='dwu7w'></bdo><ul id='dwu7w'></ul>

    <small id='dwu7w'></small><noframes id='dwu7w'>

  • <legend id='dwu7w'><style id='dwu7w'><dir id='dwu7w'><q id='dwu7w'></q></dir></style></legend>

        <tfoot id='dwu7w'></tfoot>

      1. <i id='dwu7w'><tr id='dwu7w'><dt id='dwu7w'><q id='dwu7w'><span id='dwu7w'><b id='dwu7w'><form id='dwu7w'><ins id='dwu7w'></ins><ul id='dwu7w'></ul><sub id='dwu7w'></sub></form><legend id='dwu7w'></legend><bdo id='dwu7w'><pre id='dwu7w'><center id='dwu7w'></center></pre></bdo></b><th id='dwu7w'></th></span></q></dt></tr></i><div id='dwu7w'><tfoot id='dwu7w'></tfoot><dl id='dwu7w'><fieldset id='dwu7w'></fieldset></dl></div>

        获取 EditText 的字符数

        时间:2023-10-01

        <tfoot id='SrvKj'></tfoot>
          <tbody id='SrvKj'></tbody>

          <legend id='SrvKj'><style id='SrvKj'><dir id='SrvKj'><q id='SrvKj'></q></dir></style></legend>
          • <bdo id='SrvKj'></bdo><ul id='SrvKj'></ul>
            • <small id='SrvKj'></small><noframes id='SrvKj'>

              <i id='SrvKj'><tr id='SrvKj'><dt id='SrvKj'><q id='SrvKj'><span id='SrvKj'><b id='SrvKj'><form id='SrvKj'><ins id='SrvKj'></ins><ul id='SrvKj'></ul><sub id='SrvKj'></sub></form><legend id='SrvKj'></legend><bdo id='SrvKj'><pre id='SrvKj'><center id='SrvKj'></center></pre></bdo></b><th id='SrvKj'></th></span></q></dt></tr></i><div id='SrvKj'><tfoot id='SrvKj'></tfoot><dl id='SrvKj'><fieldset id='SrvKj'></fieldset></dl></div>

                1. 本文介绍了获取 EditText 的字符数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试获取 EditText 的字符数.我研究了 EditText 和 TextView 类的不同属性,但似乎没有返回字符数量的函数.我曾尝试使用 TextWatcher,但这并不理想,因为有时我会从首选项中将保存的消息加载到 EditText 中,而 TextWatcher 不会计算当时未键入的字符.

                  I'm trying to get a character count of an EditText. I've looked into different properties of the EditText and TextView classes, but there doesn't seem to be a function that returns the amount of characters. I have tried to use the TextWatcher, but that is not ideal since sometimes I load a saved message into the EditText from the preferences, and TextWatcher does not count characters not typed right then.

                  任何帮助都会很棒!

                  干杯!

                  推荐答案

                  只需将 EditText 中的文本抓取为字符串并检查其长度即可:

                  Just grab the text in the EditText as a string and check its length:

                  int length = editText.getText().length();
                  

                  这篇关于获取 EditText 的字符数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:android EditText maxLength 不起作用 下一篇:如何使用按钮从 EditText 中删除最后一个字母?

                  相关文章

                  最新文章

                  <legend id='xsMiA'><style id='xsMiA'><dir id='xsMiA'><q id='xsMiA'></q></dir></style></legend>

                    1. <i id='xsMiA'><tr id='xsMiA'><dt id='xsMiA'><q id='xsMiA'><span id='xsMiA'><b id='xsMiA'><form id='xsMiA'><ins id='xsMiA'></ins><ul id='xsMiA'></ul><sub id='xsMiA'></sub></form><legend id='xsMiA'></legend><bdo id='xsMiA'><pre id='xsMiA'><center id='xsMiA'></center></pre></bdo></b><th id='xsMiA'></th></span></q></dt></tr></i><div id='xsMiA'><tfoot id='xsMiA'></tfoot><dl id='xsMiA'><fieldset id='xsMiA'></fieldset></dl></div>
                      • <bdo id='xsMiA'></bdo><ul id='xsMiA'></ul>
                      <tfoot id='xsMiA'></tfoot>

                      <small id='xsMiA'></small><noframes id='xsMiA'>