简体   繁体   English

actionNext&textMultiline无效

[英]actionNext & textMultiline not working

I want a Multiline EditText to allow imeOptions="actionNext" . 我想要一个Multiline EditText来允许imeOptions="actionNext"


This works, but only allows single line input 这有效,但只允许单行输入

<EditText>
    ...
    android:inputType="textCapSentences|textAutoCorrect"
    android:imeOptions="actionNext"
    ...
</EditText>

This changes the imeOption to an enter key. 这会将imeOption更改为enter键。

<EditText>
    ...
    android:inputType="textCapSentences|textAutoCorrect|textMultiline"
    android:imeOptions="actionNext" <!-- Why is this code skipped? -->
    ...
</EditText>

The Google Keep and Gmail apps do this somehow, so don't tell me it isn't possible. 谷歌Keep和Gmail应用程序以某种方式执行此操作,所以不要告诉我这是不可能的。

The enter key can only do one thing: enter new line to the editor or move cursor to the next field. 回车键只能做一件事:在编辑器中输入新行或将光标移动到下一个字段。 One way to implement this is have the enter key move to the next field but still allow text in the editor to auto-wrap. 实现这一点的一种方法是让回车键移动到下一个字段,但仍然允许编辑器中的文本自动换行。

In XML: 在XML中:

<EditText
    android:singleLine="true"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:text="@string/default_label_a"
    android:selectAllOnFocus="true"
    android:maxLines="5"
    android:imeOptions="actionNext"
/>

In code: 在代码中:

edittext.setHorizontallyScrolling(false);
edittext.setMaxLines(Integer.MAX_VALUE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM