简体   繁体   English

空的EditText上的nextFocusDown

[英]nextFocusDown on empty EditText

I have two EditTexts and need to place focus on the second one, once the user pressed "next" on the softKeyboard. 我有两个EditText,一旦用户在softKeyboard上按下“下一步”,就需要将焦点放在第二个上。 Here is my layout : 这是我的布局:

                  <EditText
                              android:id="@+id/Nom"
                              android:singleLine="true"
                              android:nextFocusDown="@+id/Prenom" 
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:paddingLeft="5dp"
                              android:text="Nom"
                              android:textSize="35dp"
                              android:textStyle="bold" />


                          <EditText
                            android:id="@+id/Prenom"
                            android:singleLine="true" 
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:enabled="false"
                            android:paddingLeft="5dp"          
                            android:textSize="25dp"
                            android:textStyle="bold" />

As long the second one is empty, no cursor is placed in it and I got a "beginbatchedit on inactive inputconnection". 只要第二个是空的,就不会在其中放置任何游标,并且我得到了“非活动输入连接上的beginbatchedit”。

But, when I put a " " in its text, there is no problem. 但是,当我在其文本中添加“”时,没有问题。 Any Ideas ? 有任何想法吗 ?

Maybe is the enabled="false" on your second EditText, just remove it: 也许是第二个EditText上的enabled =“ false”,只需将其删除即可:

                      <EditText
                        android:id="@+id/Prenom"
                        android:singleLine="true" 
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"          
                        android:textSize="25dp"
                        android:textStyle="bold" />

you can remove 你可以删除

android:nextFocusDown="@+id/Prenom"

remove 去掉

android:enabled="false"

from your first edit box and just specify the input type, when there are two continuous text boxes you press next of soft keys it will take you to next text box by default more information softKeyboard 在第一个编辑框中,仅指定输入类型,当有两个连续的文本框时,按下一个软键,默认情况下将带您到下一个文本框。更多信息softKeyboard

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM