简体   繁体   English

Android软键盘弹出并自动隐藏

[英]Android soft keyboard pops up and hides automatically

I have this strange issue where the soft keyboard keeps popping up and hiding out in my application. 我有这个奇怪的问题,软键盘不断弹出并隐藏在我的应用程序中。

It only happens on tablets, on the phone it works with no problem, only when running the app in a tablet this problem happens. 它只发生在平板电脑上,在手机上工作没有问题,只有在平板电脑上运行应用程序时才会出现这种问题。 I also tried it in real devices, the same problem occurs. 我也尝试在真实设备中,出现同样的问题。

I searched a lot for other posts that have the same problem, but I couldn't find anyone else who have the same problem. 我搜索了很多其他有相同问题的帖子,但我找不到其他有同样问题的帖子。

Here is a video of the problem: http://youtu.be/b9jJQzgxaIo 这是一个问题的视频:http: //youtu.be/b9jJQzgxaIo

Here is the manifest code for this fragment: 以下是此片段的清单代码:

<activity
        android:name="com.mapsaurus.panesexample.CreateAssignment"
        android:configChanges="orientation|screenSize"
        android:label="@string/title_activity_create_assignment" >
</activity>

I tried with and without android:configChanges="orientation|screenSize" and with and without android:windowSoftInputMode="stateVisible" but without any luck. 我尝试使用和没有android:configChanges="orientation|screenSize"和有和没有android:windowSoftInputMode="stateVisible"但没有任何运气。

I'm using Android-PanesLibrary , so the EditText field is inside a SherlockFragment not an activity, when it is in a normal activity, it works fine. 我正在使用Android-PanesLibrary ,因此EditText字段在SherlockFragment内部而不是活动,当它处于正常活动时,它工作正常。

I hope someone have a solution for this. 我希望有人能为此解决问题。

Thanks.. 谢谢..

After I wrote the question, I found the solution in my own question. 在我写完问题后,我在自己的问题中找到了解决方案。 This happens because it is a Fragment not an Activity, so I added android:windowSoftInputMode="adjustPan" to the Activity that this Fragment is attached to, and it worked. 发生这种情况是因为它是一个Fragment而不是Activity,所以我将android:windowSoftInputMode="adjustPan"添加到此Fragment附加到的Activity,并且它有效。 I think the problem was because the keyboard talks with Activities not Fragments, I don't know if this is true, but I that's the explanation for it. 我认为问题是因为键盘与Activities not Fragments对话,我不知道这是否属实,但我就是对它的解释。 I hope someone will benefit from this in the future. 我希望将来有人能从中受益。

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

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