Skip to content Skip to sidebar Skip to footer

Screen Orientation

Hi M new to android.I faced a problem i.e in landscape mode i need a layout view which doesnot have some feilds which are present in the portrait mode.I have created a layout fo

Solution 1:

You can make two different layouts and put them in layout-port and layout-land respectively. And make sure that you have mentioned android:configuration = "orientation" in your manifest for that activity. Try it if i have understood you correctly.

Solution 2:

I think that the advice by Kantesh may be backwards. As explained in the docs, if you include android:configChanges="orientation" in the manifest, then the correct resource (from layout-port or layout-land) won't be automatically loaded. Instead, leave out mention of orientation from the manifest. Then, you do not need to worry about onConfigurationChanged() (don't override it). The system will automatically shut down the activity and then restart it, binding the appropriate version of configuration-dependent resources. Handling configuration changes yourself is (again, according to the docs) only a last resort to deal with performance issues that cannot be handled in other ways.

Post a Comment for "Screen Orientation"