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

      <legend id='W223M'><style id='W223M'><dir id='W223M'><q id='W223M'></q></dir></style></legend>
        <tfoot id='W223M'></tfoot>

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

        如何大写Android EditText中的每个字母?

        时间:2023-10-01

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

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

            1. <tfoot id='Na4Hb'></tfoot>

                <legend id='Na4Hb'><style id='Na4Hb'><dir id='Na4Hb'><q id='Na4Hb'></q></dir></style></legend>
                  <bdo id='Na4Hb'></bdo><ul id='Na4Hb'></ul>
                • 本文介绍了如何大写Android EditText中的每个字母?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个这样的editTexts数组:

                  I have an array of editTexts which I make like this:

                          inputs[i] = new EditText(this);
                          inputs[i].setWidth(376);
                          inputs[i].setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
                          tFields.addView(inputs[i]);
                  

                  我希望每个字符都大写.现在,第一个单词的第一个字母是小写的,然后后面的所有字符都是大写的.我可以在用户输入完成后将其转换为大写,但这并不是我真正想要的.有没有办法让这些字段按照我想要的方式运行?

                  I want every character to be capitalized. Right now, the first letter of the first word is lowercase, then all the characters afterwords are upper case. I can take what the user inputs after they are done and convert that to uppercase, but that's not really what I'm going for. Is there a way to get these fields to behave the way I want them to?

                  推荐答案

                  你也需要告诉它来自class"文本:

                  You need to tell it it's from the "class" text as well:

                  inputs[i] = new EditText(this);
                  inputs[i].setWidth(376);
                  inputs[i].setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
                  tFields.addView(inputs[i]);
                  

                  输入类型是一个位掩码.您可以通过放置 | 来组合标志.(管道)字符在中间,它代表 OR 逻辑函数,即使在像这样的位掩码中使用它意味着这个标志和那个另一个标志".

                  The input type is a bitmask. You can combine the flags by putting the | (pipe) character in the middle, which stands for the OR logic function, even though when used in a bitmask like this it means "this flag AND that other flag".

                  (此答案与 Robin 的答案相同,但没有幻数",这是您可以在代码中放入的最糟糕的事情之一.Android API 具有常量,请使用它们而不是复制值并冒最终破坏代码的风险.)

                  (This answer is the same as Robin's but without "magic numbers", one of the worst things you can put in your code. The Android API has constants, use them instead of copying the values and risking to eventually break the code.)

                  这篇关于如何大写Android EditText中的每个字母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Android 操作栏选项卡和键盘焦点 下一篇:如何收听 EditText?

                  相关文章

                  最新文章

                • <small id='8TNS0'></small><noframes id='8TNS0'>

                  <legend id='8TNS0'><style id='8TNS0'><dir id='8TNS0'><q id='8TNS0'></q></dir></style></legend>

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

                    <tfoot id='8TNS0'></tfoot>

                        <bdo id='8TNS0'></bdo><ul id='8TNS0'></ul>