Android OS not identifying orientation changes -
Android OS not identifying orientation changes -
i have next folders within /res directory back upwards different screen densities , orientation.
/layout /layout-land /layout-small /layout-small-land /layout-large /layout-large-land
in above xmls, different alignment between components. instance, in portrait:
<linearlayout android:id="@+id/linearlayout5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/linearlayout3" android:layout_marginleft="20dp" android:layout_torightof="@+id/linearlayout3" />
whereas in landscape,
<linearlayout android:id="@+id/linearlayout5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/linearlayout3" android:layout_marginleft="60dp" //widens margin space android:layout_torightof="@+id/linearlayout3" />
however, when orientation changed, xml corresponding portrait beingness used.
here androidmanifest code snippet.
<activity android:name=".myactivity" android:configchanges="keyboard|keyboardhidden|orientation|screensize" />
i tested app in emulator android 2.2 , 3.7" screen. there missed out?
however, when orientation changed, xml corresponding portrait beingness used.
that because told android do, via:
android:configchanges="keyboard|keyboardhidden|orientation|screensize
delete attribute, , android destroy , recreate activity, applying new layout resources.
with attribute in place, your job somehow load new layout resources, in onconfigurationchanged()
.
android android-layout android-orientation
Comments
Post a Comment