按下“编辑"文本时出现两个键盘 [英] There are two keyboards appear when press on an Edit text
问题描述
我正在尝试以下视图:
- 一个EditText
- RecycleView
结果:当我按编辑文本时,将依次显示2个键盘.
Result: When I press on edit text, then there 2 keyboards which appear in order.
-
PS:此问题不会出现单个编辑文本!
PS: THIS ISSUE DON'T HAPPEN WITH SINGLE EDIT TEXT!
在设备上经过测试:Samsung A5,anroid 6.0.
Tested on device: Samsung A5, anroid 6.0.
共享屏幕快照和apk: https://drive.google.com/驱动器/文件夹/1Kw4DPk4iHtfXzVgrpTe4vzDwbRKvsy4X
Share screen shot and apk: https://drive.google.com/drive/folders/1Kw4DPk4iHtfXzVgrpTe4vzDwbRKvsy4X
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ems="10"
android:inputType="number"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText" />
推荐答案
您是什么意思?在单个编辑文本上,出现两个键盘,或者在两个编辑文本上出现两个不同的键盘.
what did you mean? on Single edit text two keyboard appear or two different keyboard appears on two edit text.
注意:我检查了您的应用,它仅在编辑文本中显示数字键盘原因,<android:inputType="number"/>
Note: I checked your app it show only number keyboard cause in edit text,<android:inputType="number"/>
您需要的代码
Here Code which you need
editText.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_ENTER)
{
return true;
}
return false;
}
});
只需添加到您的Activity.java
just add to your Activity.java
这篇关于按下“编辑"文本时出现两个键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!