Landscape and portrait android app -
i have created 2 folders layout , layout-land 2 xml files, 1 portrait , other landscape. both of xmls work here problem.
my first screen login screen , second screen main screen. if login in portrait , turn phone landscape @ main screen. layout landscape turn uses portrait xml main screen.
the same error occurs if start in landscape , try move portrait later on.
it seems whatever layout main that's layout used rest of app. there anyway go around this?
also. i'm using android:configchanges="orientation" in manifest activities.
if using android:configchanges="orientation"
, can override onconfigurationchanged
inflate new layout after configuration change.
@override protected void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); setcontentview(...); }
make sure have reason preventing activity being recreated on orientation change... , importantly don't because orientation changes crashing app. handling configuration change can make more difficult use alternative resources, because system not automatically apply them you. technique should considered last resort when must avoid restarts due configuration change , not recommended applications.
Comments
Post a Comment