2011-01-11 82 views

回答

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(); 
    } 
} 

我希望這可以幫助您

+0

softKeyboard顯示/隱藏從未觸發onConfigurationChanged() – fantouch 2014-09-13 09:43:00