Appwidget尺寸计算尺寸、Appwidget

2023-09-13 02:32:55 作者:冷面酷血

这可能是我,但是当我算最小的应用程序部件尺寸根据Android的页面我没有得到正确的部件宽度上给出的公式;计算公式为follows:

It might be me, but when I calculate minimum app widget sizes according to the formula given on the android page I don't get the right widget widths; The formula is as follows:

宽度(N)=(70×N) - 30

width(n) = (70 x n) - 30

当我想有一个5X1小部件,正确的宽度将是(5 * 70) - 30 = 320dp。但是在摩托罗拉Xoom测试这个时候它解析为是一个4X1部件。我测试过不同的价值观和400dp似乎不错的5X1的摩托罗拉Xoom与蜂窝,但我会测试它经常Galaxy Tab的姜饼,然后将其解析为一个6×1(像预期的那样)。

When I want to have a 5x1 widget, the correct width would be (5 * 70) - 30 = 320dp. However when testing this on a motorola Xoom it resolves to being a 4x1 widget. I've tested different values and 400dp seems good for 5x1 on the motorola xoom with Honeycomb, but then I'd test it on a regular Galaxy Tab with Gingerbread and then it resolves to a 6x1 (like one would expect).

于是两个问题;

在我俯瞰什么区别姜饼和蜂窝之间? 在因为我知道ICS窗口小部件的大小不再有小部件之间的填充,是有经验的某些规则在这里也?

推荐答案

没有太多的设备完全效仿谷歌的建议公式。你最好还是使用XML为XXX文件夹,可以指定更精确和了minWidth放大器;了minHeight对应于不同的屏幕和安培;操作系统。

Not too many devices fully follow Google's advised formula. You're better off using several xml-xxx folders that can specify more accurate minWidth & minHeight that correspond to the varying screens & OSes.

现在我4只基于OS:

xml       // standard
xml-v11   // Honeycomb grid
xml-v14    // ICS's new extra padding
xml-sw552dp-v14  // ICS tablet padding

不过,正如我微调,我可能要添加一些新的文件夹为特定的DPI或屏幕。

But as I fine tune, I may have to add a few new folders for particular dpis or screens.

快速更新:

只有一些设备使用自动填充。三星和放大器; HTC有使用全角的小部件定制用户界面,因此他们重写OS填充自己的发射器。

Only some devices use automatic padding. Samsung & HTC have custom UIs that use full-width widgets, so they override the OS padding on their launchers.