0
このコードを使用してレイアウトの方向の変更を検出していますが、次のコードでは、レイアウトランドに保持されているレイアウトの代わりに同じポートレートのレイアウトが使用されています。Android向きの変更
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();
}
}
<activity android:name=".MyActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name">
[Androidオリエンテーション変更](http://stackoverflow.com/questions/4616176/android-orientation-change)の複製可能 –
どういう意味ですか?方向を変更すると、常に "else if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){"の場合、 "portrait"が表示されますか?またはレイアウトが変更されていませんか? – AndroDev