EditText上加倍了在旋转 [英] EditText doubling out on rotate
问题描述
我在使用一个EditText控制的问题。这个问题只发生在这个特殊的活动,并没有其他的活动EditTexts。我已经删除了所有的setText调用此的EditText和问题仍然存在。
I'm having an issue with an EditText control. This issue is only happening on this particular Activity and no other Activities with EditTexts. I have removed all setText calls for this EditText and the problem still persists.
我正在我的移动设备上的Android 2.3.4。这是一个的Nexus S运行Android的股票。在仿真器(运行Android 2.2)不会出现此问题。
I am running Android 2.3.4 on my mobile device. It is a Nexus S and running stock Android. In the emulator (running Android 2.2) this problem does not occur.
当我旋转手机,Android的自动替换,这是在EditText上旋转以前的状态。我不使用savedInstanceState做任何事情。 Android正在这样做本身。
When I rotate the phone, Android automatically replaces the text that was in the EditText before the rotation. I'm not using savedInstanceState to do anything. Android is doing this itself.
我的问题:
假设单词测试是在EditText上。当我旋转手机,Android将会把testtest成的EditText重新创建活动时。这仅当我使用虚拟键盘键入到EditText上发生了,我不点击完成按钮,虚拟键盘上,我preSS回删除虚拟键盘,和我然后旋转设备。如果我使用返回按钮的完成按钮,而不是,不会发生问题。
Suppose the word "test" is in the EditText. When I rotate the phone, Android will place "testtest" into the EditText when the Activity is re-created. This only happens when I use the virtual keyboard to type into the EditText, I do not click the "done" button on the virtual keyboard, I press back to remove the virtual keyboard, and I then rotate the device. If I use the "done" button instead of the back button, the problem does not occur.
任何想法?正如我所说,我的不可以设置文本。调用的setText所有的线都被注释掉。
Any ideas? As I said, I am NOT setting the text. All lines that call setText have been commented out.
更新1:我有注释掉一切都在这个活动除了的onCreate()方法。问题仍然存在。
更新2:我创建了一个新的活动。这家全新的活动,只需要的onCreate()方法。在OnCreate()方法的唯一的事情就是调用的setContentView(使用相同的布局文件)并调用超的onCreate()。问题仍然存在。我难倒。我唯一能猜到是有一些怪诞的布局文件。我没有任何想法,这将是。
更新3:我已经剥离出来的一切,除了EditText上的布局。问题仍然存在。
推荐答案
我也有类似的问题,但我只看到它时,打开自动完成了的EditText。
I had a similar problem but I only see it when the AutoComplete is turned on for the EditText.
我的工作就是围绕禁用自动完成。
<的EditText
。
。
。
机器人:inputType =textMultiLine | textNoSuggestions
/>
My work around was to disable autocomplete.
<EditText
.
.
.
android:inputType="textMultiLine|textNoSuggestions"
/>
这篇关于EditText上加倍了在旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!