开发者

Android Screen Orientation

开发者 https://www.devze.com 2023-01-21 22:09 出处:网络
I developed an application in portrait mode in Android. What changes do I have to do, that my applicationwill be also fit for landscape orientation?

I developed an application in portrait mode in Android.

What changes do I have to do, that my application will be also fit for landscape orientation?

Th开发者_JAVA技巧anks in advance.


Technically speaking, you don't HAVE to make any changes for it to fit to landscape. It you're using the standard wrap_content and fill_parent for your width and height, your layout will automatically adjust when you change orientations.

With that said, you will often WANT to change to a different layout when switching from portrait to landscape, as a layout that looks good vertically may be unusable when horizontal. You can add a new folder beside your /layout folder titled layout-land. In this, make a new XML file with the same title as your previous layout, and then change the layout from there. Be sure that any and all defined android:ids exist in both the original and landscape layout.


Make sure you use layout_width as "fill_parent" where ever required.

0

精彩评论

暂无评论...
验证码 换一张
取 消