如题,Configuration等于ORIENTATION_LANDSCAPE就不响应呢?
下面是代码。
public void onConfigurationChanged(Configuration newConfig) { 
// TODO Auto-generated method stub 

if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { 
mButton01.setText(R.string.str_button2); 
//mMakeTextToast ( getResources().getText (R.string.str_onConf_LANDSCAPE).toString(), false ); 


if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { 
mButton01.setText(R.string.str_button1); 
//mMakeTextToast ( getResources().getText (R.string.str_onConf_PORTRAIT).toString(), false ); 


super.onConfigurationChanged(newConfig); 

解决方案 »

  1.   

    在manifest对应的Activity加
    android:configChanges="orientation"
      

  2.   

    在 AndroidManifest.xml里修改
    android:configChanges="keyboardHidden|orientation"
      

  3.   

    回答正确,关键是参数keyboardHidden。
    但是问题又来了,这个事件里怎么设置不上文字到textview呢?
      

  4.   

    我查出来原因是先进入切屏时间,又进入create事件,为什么呢?
    网上资料说设置了参数android:configChanges="keyboardHidden|orientation"就不会刷新activity了呀?
      

  5.   

    转屏的和keyboardHidden根本就两码事好不好,keyboardHidden是有侧滑全键盘滑动的时候才响应的,转屏是由orientation响应的.
      

  6.   

    你肯定没有高清楚,我给你个地址,你去看看,我都是及测试过的。
    http://www.cnblogs.com/zhangkai281/archive/2011/07/06/2099277.html
      

  7.   

    你toast一个提示框是什么样的情况,把LOG打印出来
      

  8.   

    "keyboardHidden" The keyboard accessibility has changed — for example, the user has revealed the hardware keyboard.
    "orientation" The screen orientation has changed — the user has rotated the device.
    Note: If your application targets API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), then you should also declare the "screenSize" configuration, because it also changes when a device switches between portrait and landscape orientations.http://developer.android.com/guide/topics/manifest/activity-element.html
      

  9.   

    补充一下,我的这个activity是嵌套在tab里面的
      

  10.   

    "orientation|keyboardHidden"> 看看是不是因为写反了
      

  11.   

    我已经解决了,还要在AndroidManifest.xml中的管理tabhost的activity(也就是主activity)中增加选项android:configChanges="orientation|keyboardHidden",就不会在切换屏幕的时候总是进入这个tab的activity的onCreate事件中了。