Now how do we make sure both of the orientations are optimized? Android provides a way to do this as effortless as possible. The only thing you have to do is create a new sub folder in the res folder. Let me just point out the three folders you can use/make to do this:
- layout-land: The Android system will use these layouts when the device is in landscape view.
- layout-port: The Android system will use these layouts when the device is in portrait view.
- layout: This is the default folder for your layouts. If the system could not find the specified folder of the orientation, it will use the layouts inside this folder. So basically you just need to make one of the folders above.
Just make sure the layout files have the same name. That's all you have to do, it's just as simple as that.
Here's a small example of how your layouts should be organized.
No comments:
Post a Comment