EditText输入类型textCapSentences不适用于Lollipop

coo*_*Boy 13 android android-layout android-xml android-edittext android-5.0-lollipop

我已经android:inputType="textAutoComplete|textCapSentences"在我的xml代码中实现了.当我在kitkat上运行它时,textCapSentence工作正常,但是当在Lollipop设备上运行时,它不起作用.任何人都知道如何解决它.

jap*_*ngh 23

嗨,这是因为在棒棒糖中,如果您在键盘设置中禁用了自动大写,则无法以编程方式启用它.

以下是步骤: -

  • 点击Android Lollipop设备主屏幕上的"设置"图标
  • 在"设置"屏幕上,向下滚动到"个人"部分,然后点击"语言和输入"部分.
  • 在"语言和输入"部分,选择您的键盘(标记为当前键盘).
  • 现在点击"首选项".
  • 点击以检查"自动 - 大写"以启用它.
  • 就这样!

  • 好的就是这样!它现在正在工作.谢谢!! (2认同)

Int*_*iya 6

这样设置

EditText input = (EditText).findViewById(R.id.ID);
input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
Run Code Online (Sandbox Code Playgroud)