开发者

An orientation bug in android-sdk-windows\samples\android-11\SoftKeyboard

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:

  1. rotate the phone to landscape mode while using the keyboard.
  2. press phone's power key to make phone's screen off.
  3. rotate the phone to portrait mode.
  4. press phone's power key to wake up the phones's screen.
  5. swipe the screen to close the screen lock.
  6. The keyboard only displays half part in portrait mode.开发者_JAVA百科 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜