EditText with single text line, line wrapping and Done action?

后端 未结 2 1529
慢半拍i
慢半拍i 2021-02-12 09:27

I am trying to have an EditText with the following characteristics when editing with a soft key. I ready the documentation, searched here, play with the parameters

2条回答
  •  迷失自我
    2021-02-12 10:02

    This combination (and the specific order of the EditText method calls) should produce the configuration that you want:

      editText.setInputType(
        InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
      editText.setSingleLine(true);
      editText.setLines(4); // desired number of lines
      editText.setHorizontallyScrolling(false);
      editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
    

提交回复
热议问题