【发布时间】:2017-10-02 06:05:18
【问题描述】:
我有 EditText,输入类型是 textNoSuggestions。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Name"
android:inputType="textNoSuggestions" />
</android.support.design.widget.TextInputLayout>
我还有一个按钮,在按钮 onclick 方法中我尝试更改键盘的输入类型。这是一个来源
final Button changeKeyboard = (Button) dialog.findViewById(R.id.change_keyboard);
changeKeyboard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
firsName.setRawInputType(InputType.TYPE_CLASS_NUMBER);
}
});
当键盘显示时,是否可以在单击按钮时更改键盘的输入类型? 我该如何解决我的问题谢谢大家
【问题讨论】:
-
这似乎是一个独特的问题,搜索SO后,我找不到类似的问题。祝你好运找到答案。
标签: android android-edittext android-button android-keypad