EditText 自动建议为空白或不存在
EditText auto suggestions are blank or non existing
我有一个标准的直截了当的 EditText,我想在此 EditText 之上显示字典建议,所以我在 XML:
中这样做了
<EditText
android:id="@+id/messaging_messageEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:layout_weight="85"
android:background="@drawable/clanz_edit_text_holo_dark"
android:ems="10"
android:hint="Type your message here..."
android:singleLine="true"
android:inputType="textAutoComplete"
android:textColor="#dedede" >
</EditText>
我认为 inputType
参数会处理自动字典视图。在我的 phone (Nexus Android 5.1) 上,字典视图出现但为空白。在 Genymotion 模拟器 (Android 4.1.1) 上它根本不显示。
我错过了什么?
如果您正在寻找自动完成 TextView,这可能是一种解决方案。
<AutoCompleteTextView
android:id="@+id/from_station"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/enter_start"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:textColorHint="@color/transparent_black" />
您还可以使用参数设置阈值。
需要在运行时设置适配器值。
如果我没理解错的话,你希望键盘自动更正吗?
根据 Android 开发者网站:
Can be combined with text and its variations to specify that this
field will be doing its own auto-completion and talking with the input
method appropriately. Corresponds to TYPE_TEXT_FLAG_AUTO_COMPLETE.
这不是您要查找的内容。根据 Android 开发者网站,您可能正在寻找 textAutoCorrect
:
Can be combined with text and its variations to request
auto-correction of text being input. Corresponds to
TYPE_TEXT_FLAG_AUTO_CORRECT.
我制作了很多应用程序,但从未使用过其中一个。如果您有正常的 EditText
.
,它只会自动更正
我有一个标准的直截了当的 EditText,我想在此 EditText 之上显示字典建议,所以我在 XML:
中这样做了<EditText
android:id="@+id/messaging_messageEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:layout_weight="85"
android:background="@drawable/clanz_edit_text_holo_dark"
android:ems="10"
android:hint="Type your message here..."
android:singleLine="true"
android:inputType="textAutoComplete"
android:textColor="#dedede" >
</EditText>
我认为 inputType
参数会处理自动字典视图。在我的 phone (Nexus Android 5.1) 上,字典视图出现但为空白。在 Genymotion 模拟器 (Android 4.1.1) 上它根本不显示。
我错过了什么?
如果您正在寻找自动完成 TextView,这可能是一种解决方案。
<AutoCompleteTextView
android:id="@+id/from_station"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/enter_start"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:textColorHint="@color/transparent_black" />
您还可以使用参数设置阈值。 需要在运行时设置适配器值。
如果我没理解错的话,你希望键盘自动更正吗?
根据 Android 开发者网站:
Can be combined with text and its variations to specify that this field will be doing its own auto-completion and talking with the input method appropriately. Corresponds to TYPE_TEXT_FLAG_AUTO_COMPLETE.
这不是您要查找的内容。根据 Android 开发者网站,您可能正在寻找 textAutoCorrect
:
Can be combined with text and its variations to request auto-correction of text being input. Corresponds to TYPE_TEXT_FLAG_AUTO_CORRECT.
我制作了很多应用程序,但从未使用过其中一个。如果您有正常的 EditText
.