如题,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);
}
下面是代码。
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);
}
android:configChanges="orientation"
android:configChanges="keyboardHidden|orientation"
但是问题又来了,这个事件里怎么设置不上文字到textview呢?
网上资料说设置了参数android:configChanges="keyboardHidden|orientation"就不会刷新activity了呀?
http://www.cnblogs.com/zhangkai281/archive/2011/07/06/2099277.html
"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