【发布时间】:2011-06-28 04:55:25
【问题描述】:
有没有办法让多行EditText 存在并在 Android 2.3 上使用 IME 操作标签“完成”?
在 Android 2.2 中这不是问题,输入按钮显示 IME 操作标签“完成”(android:imeActionLabel="actionDone"),并在单击时关闭软输入。
在为多行配置 EditText 时,Android 2.3 移除了为软输入键盘显示“完成”操作的功能。
我已经设法通过使用KeyListener 更改了软输入回车按钮的行为,但是回车按钮看起来仍然像回车键。
这是EditText的声明
<EditText
android:id="@+id/Comment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="0dp"
android:lines="3"
android:maxLines="3"
android:minLines="3"
android:maxLength="60"
android:scrollHorizontally="false"
android:hint="hint"
android:gravity="top|left"
android:textColor="#888"
android:textSize="14dp"
/>
<!-- android:inputType="text" will kill the multiline on 2.3! -->
<!-- android:imeOptions="actionDone" switches to a "t9" like soft input -->
当我在加载活动中设置内容视图后检查inputType值时,它显示为:
inputType = 0x20001
这是:
- class=
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL - 标志 =
InputType.TYPE_TEXT_FLAG_MULTI_LINE
【问题讨论】: