android-sdk-windows\samples\android-11\SoftKeyboard 中的方向错误
我是 Android 应用程序的初学者。我正在使用 sdk android-sdk-windows\samples\android-11\SoftKeyboard 中提供的键盘示例代码。我已经在其中添加了一些功能,但我发现此示例代码中存在方向问题。键盘在纵向模式下仅显示一半。如果不添加我的代码,也可能会发生此问题。
以下是重复的步骤:
- 使用键盘时将手机旋转至横向模式。
- 按手机电源键关闭手机屏幕。
- 将手机旋转至纵向模式。
- 按手机电源键唤醒手机屏幕。
- 滑动屏幕即可关闭屏幕锁。
- 键盘在纵向模式下仅显示一半。即使手机处于纵向模式,键盘似乎仍处于横向模式。
这个问题在 Android 1.6 平台上不会发生,但我可以在 Android 2.2 和 2.3 中重复这个问题。 我尝试在 SoftKeyboard.java 中添加一些日志。我发现1.6和2.x之间有区别。函数“onCreateInputView()”在 1.6 中的第 5 步之后被调用,但在 2.x 中的第 5 步之后没有被调用。
任何人都可以帮助我吗?我该如何解决它。我必须解决这个问题。 谢谢。
公爵
I am a beginner of Android app. I am using the keyboard sample code provided in sdk android-sdk-windows\samples\android-11\SoftKeyboard. I have put some features in it but I found there is a orientation problem in this sample code. The keyboard only displays half part in portrait mode. This problem can happen without adding my code.
Here is the duplicate steps:
- rotate the phone to landscape mode while using the keyboard.
- press phone's power key to make phone's screen off.
- rotate the phone to portrait mode.
- press phone's power key to wake up the phones's screen.
- swipe the screen to close the screen lock.
- The keyboard only displays half part in portrait mode. Seems like the keyboard is still in landscape mode even though the phone is in portrait mode.
This problem doesn't happen in Android 1.6 platform but I can duplicate this problem in Android 2.2 and 2.3.
I tried to add some logs in SoftKeyboard.java. I found there is a difference between 1.6 and 2.x. The function "onCreateInputView()" is called after step 5 in 1.6 but it's not called in 2.x after step 5.
Can any one help me? How can I fix it. I have to fix this problem.
Thank you.
Duke
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过很长时间的调试,我终于找到了答案。
这是因为 AndroidManifest.xml 中 android:minSdkVersion 的值。
我将值定义为2。改为4后,一切就完美了。
唉,浪费了很多时间。
After long long time debugging, I finally found the answer.
It's because of the value of android:minSdkVersion in AndroidManifest.xml.
I defined the value as 2. After changing to 4, everything is just perfect.
Ouch, wasted a lot of time.