布局管理的android布局、android

2023-09-05 08:48:37 作者:心囚

其实我已经创造了所有的屏幕分辨率的应用程序。在这样的情况,根据文件我已经在提供不同的布局设计适用于不同的屏幕尺寸,不同的位图可绘于中,高,超高密度的屏幕的应用程序创建资源目录的列表。

Actually i have created an app for all screen resolution. So for that, according to the documentation i have created a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for medium, high, and extra high density screens.

例如:

RES /布局正常/ my_layout.xml //布局正常屏幕尺寸(默认)

RES /布局小/ my_layout.xml //布局为小屏​​幕尺寸

RES /布局大/ my_layout.xml //布局大屏幕尺寸

RES /布局XLARGE / my_layout.xml //布局超大屏幕

现在运行时我在不同的设备应用我所看到的是,一些设备与来自同一个资源目录,不同的屏幕分辨率将需要布局,即布局正常的,例如,这种设备有:

Now while running my app in different device what i notice is that some of the device with different screen resolution take layout from the same resource directories i.e layout-normal, and example of such devices are:

HVGA(320×480)

HVGA (320 x 480)

400的WQVGA(240×400)

WQVGA 400 (240 x 400)

WVGA(480×800)

WVGA (480 x 800)

WXGA(720×1280)

WXGA (720 x 1280)

由于使用布局的从相同的资源的目录即布局法线是非常困难的,因为它们采取相同的布局我管理在UI之间的空间为所有设备。因为如果我管理的HVGA布局则没有关系,叔看在其他的好,becoz决议。

Due to the use of layout from same resource directories i.e layout-normal it very difficult for me to manage the space between the UI for all device as they take the same layout. Because if i manage the layout for HVGA then it doesn,t look good in other, becoz of resolution.

那么,有什么办法可以解决这个问题。请帮我解决了这一点。

So is there any way to solve this problem. Please help me to solve this out.

推荐答案

@hasMukh指出了正确的方向,但如果你想在布局的4个设备更precise。我建议你​​使用布局密度分辨率格式排版文件夹命名。作为一个例子,

@hasMukh has pointed the right direction, but if you want the layouts for those 4 devices to be more precise. I suggest you to use the "layout-density-resolution" format for layout folder naming. As an example,

为HVGA(小320x480)的布局文件夹应该是布局 - 华电国际 - 小480x320 为WQVGA(240X400)的布局文件夹应该是布局LDPI-400X240 为WVGA(480×800)的布局文件夹应该是布局MDPI-800×480 为WXGA(720x1280)布局文件夹应该是布局MDPI-1280×720

for HVGA(320x480) layout folder should be "layout-hdpi-480x320" for WQVGA(240x400) layout folder should be "layout-ldpi-400x240" for WVGA(480x800) layout folder should be "layout-mdpi-800x480" for WXGA(720x1280) layout folder should be "layout-mdpi-1280x720"

此方法仅好,如果你正计划针对特定的少数devices..and你可以只保留一个drawabale文件夹,使用DP值的布局。

This method is only good if you are planning to target specific few devices..and you can keep only one drawabale folder and use dp values for layouts.