有没有办法让Multi-Line EditText
出现并在Android 2.3上使用IME Action Label"Done"?
在Android 2.2中,这不是问题,输入按钮显示IME操作标签"完成"(android:imeActionLabel="actionDone"
),并在单击时取消软输入.
配置EditText
多线时,Android 2.3无法显示软输入键盘的"完成"操作.
我已经设法通过使用a来改变Soft Input输入按钮的行为KeyListener
,但是enter按钮仍然看起来像一个回车键.
这是宣言 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 -->
Run Code Online (Sandbox Code Playgroud)
inputType
在加载后在活动中设置内容视图时检查值,它显示为:
inputType = 0x20001
Run Code Online (Sandbox Code Playgroud)
这是:
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL
InputType.TYPE_TEXT_FLAG_MULTI_LINE