gpt4 book ai didi

android - Android 上不同屏幕尺寸的不同布局?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:53:59 26 4
gpt4 key购买 nike

因此,我在 Eclipse 中使用图形编辑器、AbsoluteLayout、固定像素值等制作了一个应用程序……这通常是不好的做法。它默认为 3.7 英寸屏幕。有没有办法为每个屏幕尺寸设计 单独的布局,并让程序根据所述屏幕尺寸选择加载哪个?

最佳答案

Provide different layouts for different screen sizes By default, Android resizes your application layout to fit the current device screen. In most cases, this works fine. In other cases, your UI might not look as good and might need adjustments for different screen sizes. For example, on a larger screen, you might want to adjust the position and size of some elements to take advantage of the additional screen space, or on a smaller screen, you might need to adjust sizes so that everything can fit on the screen.
The configuration qualifiers you can use to provide size-specific resources are small, normal, large, and xlarge. For example, layouts for an extra large screen should go in layout-xlarge/.

Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you should instead use the sw<N>dp configuration qualifier to define the smallest available width required by your layout resources. For example, if your multi-pane tablet layout requires at least 600dp of screen width, you should place it in layout-sw600dp/. Using the new techniques for declaring layout resources is discussed further in the section about Declaring Tablet Layouts for Android 3.2.

来自 Android developer site - 只需使用 layout-small/layout-xlarge/等。文件夹 :=)有史以来最好的方法..

关于android - Android 上不同屏幕尺寸的不同布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6489525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com