我想知道鍵盤何時關閉,所以我使用android:configChanges="orientation|keyboardHidden"
。我必須重寫方法 onConfigurationChanged
,但似乎沒有發生。難道我做錯了什麼?「orientation | keyboardHidden」not calling onConfigurationChanged
2
A
回答
0
您是否在重寫的方法中添加了super.onConfigurationChanged(newConfig);
?
1
看日期,可能你有你的問題的解決方案,否則:
下面是我對相關的另一個問題做出同樣的反應:Is there a way to tell if the soft-keyboard is shown?
,但我在這裏複製響應的一部分避免死鏈接:
這裏是一個特定樣品:
檢查一個更好地瞭解http://developer.android.com/guide/topics/resources/runtime-changes.html
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
}
// Checks whether a hardware keyboard is available
if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
Toast.makeText(this, "keyboard visible", Toast.LENGTH_SHORT).show();
} else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
Toast.makeText(this, "keyboard hidden", Toast.LENGTH_SHORT).show();
}
}
我希望這可以幫助您
相關問題
- 1. 工作? android:configChanges =「keyboardHidden | orientation | screenSize + onConfigurationChanged
- 2. android:configChanges =「keyboardHidden | orientation」發行Android
- 3. 「keyboardHidden |方向|屏幕尺寸」 onConfigurationChanged不叫
- 4. MonoDroid OnConfigurationChanged Not Firing
- 5. publishProgress not calling onProgressUpdate
- 6. AsyncTast not calling onPostExecute
- 7. Not calling javascript function
- 8. android onActivityResult not calling
- 9. StartMonitoringSignificantLocationChanges not calling didupdatedLocations
- 10. ValidationEventHandler not calling
- 11. SearchWidget not calling onSearchRequested()
- 12. NSNotification not calling
- 13. BOOT_COMPLETED not calling BroadcastRecevier
- 14. AsyncTask callback not calling
- 15. InvokeCommandAction not calling
- 16. self.tabBarController.selectedIndex not calling viewDidAppear:YES
- 17. Passport Not calling callback
- 18. Passportjs not calling isAuthenticate
- 19. Invalidate not calling onDraw()
- 20. FB.GetAuthResponse not calling回調
- 21. AsyncTask not calling onProgressUpdate,onPostExecute
- 22. [UWP] - OnActivated Event not calling
- 23. Java MimeMessage.saveChanges not calling updateMessageID
- 24. Android CursorAdapter not calling newView
- 25. twisted loopingcall not calling errback
- 26. Datatable not calling javascript function
- 27. ios UIViewController not calling viewDidUnload
- 28. $ timeout()not calling inappbrowser [Ionic]
- 29. QTcpServer :: incomingConnection(qintptr)not calling
- 30. QMultilineElement not calling QEntryDidEndEditingElement:on delegate
softKeyboard顯示/隱藏從未觸發onConfigurationChanged() – fantouch 2014-09-13 09:43:00