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

    1. <tfoot id='8zeGK'></tfoot>

    2. <small id='8zeGK'></small><noframes id='8zeGK'>

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

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

      How to capitalize every letter in an Android EditText?(如何大写Android EditText中的每个字母?)
    4. <i id='k8Cn0'><tr id='k8Cn0'><dt id='k8Cn0'><q id='k8Cn0'><span id='k8Cn0'><b id='k8Cn0'><form id='k8Cn0'><ins id='k8Cn0'></ins><ul id='k8Cn0'></ul><sub id='k8Cn0'></sub></form><legend id='k8Cn0'></legend><bdo id='k8Cn0'><pre id='k8Cn0'><center id='k8Cn0'></center></pre></bdo></b><th id='k8Cn0'></th></span></q></dt></tr></i><div id='k8Cn0'><tfoot id='k8Cn0'></tfoot><dl id='k8Cn0'><fieldset id='k8Cn0'></fieldset></dl></div>
          • <bdo id='k8Cn0'></bdo><ul id='k8Cn0'></ul>
            <tfoot id='k8Cn0'></tfoot>

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

                <tbody id='k8Cn0'></tbody>
              <legend id='k8Cn0'><style id='k8Cn0'><dir id='k8Cn0'><q id='k8Cn0'></q></dir></style></legend>

                本文介绍了如何大写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中的每个字母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How can I detect integer overflow on 32 bits int?(如何检测 32 位 int 上的整数溢出?)
                Local variables before return statements, does it matter?(return 语句之前的局部变量,这有关系吗?)
                How to convert Integer to int?(如何将整数转换为整数?)
                How do I create an int array with randomly shuffled numbers in a given range(如何在给定范围内创建一个随机打乱数字的 int 数组)
                Inconsistent behavior on java#39;s ==(java的行为不一致==)
                Why is Java able to store 0xff000000 as an int?(为什么 Java 能够将 0xff000000 存储为 int?)

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

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

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

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

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