How do I set multiple input types in an EditText on Android?

后端 未结 3 1544
说谎
说谎 2021-02-07 09:45

I am trying to create an EditText with auto-capitalization and auto-correction implemented. I have manually figured out how to add InputFilters to allo

3条回答
  •  终归单人心
    2021-02-07 10:05

    I hope you've found an answer to the question. The answer might help those those come to the thread later. So, you can set multiple tags in similar manner as you do in XML using a | (pipe). Something like:

    EditText mEditText = new EditText(this);
    mEditText.setInputType(InputTpe.TYPE_TEXT_FLAG_CAP_CHARACTERS|InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    

    Also, depending on your situation you might want to use setInputTypeor setRawInputype.

提交回复
热议问题