开发者

How to design a layout that looks good in portrait and landscape orientations?

I am finding that my layouts tend to look great in one orientation but if I change the phone's orientation, things are a mess. For example on one screen I have 6 large buttons that look great in portrait orientation but if the user changes phone orientation, those buttons get cut off in portrait.

Do I need to code two layouts for every screen - one for portrait and 开发者_如何转开发one for landscape? That would be such a waste of time.


Yes


According to Hello, Android by Ed Burnette . . .

You could try to adjust the layout so that it works with all orientations. Unfortunately, that's often not possible or leads to odd-looking screens. When that happens, you'll need to create a different layout for landscape mode.


I think the best choice is Constraint Layout for now. But in Android Community even for a single Manifacturer there is a lot of devices and different screen sizes.you have to lean a border of screen, start from there and design your app from that border. Also every single user can choose different sizes for their displays (dp) and fonts (sp). For those choices you can use different styles.xml files. Like strings.xml has different files for different languages, styles.xml also has different files for different dp selections. Also you need to handle this kind of stuffs. And do everything twice for landscape and portrait mode with different layouts.

As you see it's a lot of work. So simple design is the most important thing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜