Có cách nào để hiển thị Nhiều dòng EditText
và sử dụng Nhãn hành động IME "Xong" trên Android 2.3 không?
Trong Android 2.2, đây không phải là vấn đề, nút enter hiển thị Nhãn hành động IME "Xong" ( android:imeActionLabel="actionDone"
) và loại bỏ Nhập liệu mềm khi được nhấp.
Khi định cấu hình EditText
cho nhiều dòng, Android 2.3 sẽ loại bỏ khả năng hiển thị hành động "Xong" đối với bàn phím Nhập liệu mềm.
Tôi đã quản lý để thay đổi hoạt động của nút nhập Soft Input bằng cách sử dụng a KeyListener
, tuy nhiên nút enter vẫn trông giống như phím enter.
Đây là tuyên bố của 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 -->
Khi tôi kiểm tra inputType
giá trị sau khi tải, cài đặt chế độ xem nội dung trong hoạt động, nó hiển thị là:
inputType = 0x20001
Đó là:
- lớp học =
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL
- cờ =
InputType.TYPE_TEXT_FLAG_MULTI_LINE