I am developing a app it has two activity. A1 only supported portrait, A2 supported two orientation. When the device is portrait and then I switch to A2. The layout of A2 is fine. But the device is landscape and then switch to A2, the layout confused. The first width and height are exchanged.
I setup the UI like this:
onCreate () {
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
setupUI(dm.widthPixels, dm.heightPixels);
}
Have anyway to set the default orientation or other way can resolve this problem? Thx.