我创建了标准的Hello World应用程序从朱诺4.21和SDK 21阿比17. Eclipse中接受的所有默认值
我使用的拖放图形界面添加了一个单一的EditText字段名。我没有任何逻辑添加到活动中
用的Nexus 7设备的Android 4.2运行出现以下错误反复
E / SpannableStringBuilder(6610):SPAN_EXCLUSIVE_EXCLUSIVE跨度不能有长度为零
当我运行的模拟器但是其中的Nexus 7模拟器我没有得到任何错误,也对我的华为ICS 4.0.3设备的正常工作。这使我相信这是一个我与我的Nexus 7的问题
有没有人谁可以测试此此一台Nexus 7或其他4.2的设备吧。
在 <的EditText
机器人:ID =@ + ID / editText1
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignRight =@ + ID / textView1
机器人:layout_below =@ + ID / textView1
机器人:EMS =10
机器人:inputType =textPersonName>
<不是requestFocus />
< /的EditText>
解决方案
所以,我一直没能拿出一个很好的解释为什么出现这种情况,但它似乎有事情做与自动完成。我有一个显示用户名和密码领域的标准登录对话框。我已经得到的是它的唯一方法是:
this.username.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
this.password.setInputType(InputTypeTYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
此,也可以在XML使用相应的标记进行。
I created the standard "hello world" application from Juno 4.21 and SDK 21 Api 17. Accepting all the defaults from Eclipse
I added a single edittext field NAME using the drag and drop graphical interface. I did not add any logic to the activity
Running with a Nexus 7 device Android 4.2 I get the following error repeatedly
E/SpannableStringBuilder(6610): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
When I run on the Emulators however including Nexus 7 emulator I get no error, also on my Huawei ICS 4.0.3 device it works fine. This leads me to believe this a my be a problem with my Nexus 7.
Is there someone who could test this on this on a Nexus 7 or other 4.2 device please.
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/textView1"
android:layout_below="@+id/textView1"
android:ems="10"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
解决方案
So I have not been able to come up with a good explanation WHY this happens, but it appears to have something to do with the Autocomplete. I have a standard login dialog box that displays a username and password field. The only way I've gotten it to behave is by:
this.username.setInputType( InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS );
this.password.setInputType( InputTypeTYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS );
This could also be done in the XML using the corresponding tags.