设计适应性强且可无缝缩放的 Android widget。使用我们推荐的 以默认尺寸为起点,测试不同尺寸下的 以确保最佳的可读性和用户体验。
默认尺寸
通过针对至少一个应用优化布局,提供精美的 widget 体验
推荐尺寸中的一种确保在 widget 中的位置和可见性正确
来为选择器指定 targetCellWidth
和 targetCellHeight
属性,
手持设备和平板电脑设备
这些值基于 Pixel 设备。您可以从这些尺寸入手 来设计微件在不同的尺寸下全面测试您的 widget 以确保良好的用户体验
手持设备
尺寸 | 最小宽度 | 最大宽度 | 最小高度 | 最大高度 |
---|---|---|---|---|
2x1 | 109 | “设置在应用程序有更新时是否通知您” | 44 | 130 |
2x2 | 109 | “设置在应用程序有更新时是否通知您” | 115 | 276 |
2x3 | 109 | “设置在应用程序有更新时是否通知您” | 185 | 422 |
4x1 | 245 | 624 | 44 | 130 |
4x2 | 245 | 624 | 115 | 276 |
4x3 | 245 | 624 | 185 | 422 |
平板电脑
尺寸 | 最小宽度 | 最大宽度 | 最小高度 | 最大高度 |
---|---|---|---|---|
2x1 | 180 | “创建 Google Checkout 账户” | 64 | 120 |
2x2 | 180 | “创建 Google Checkout 账户” | 184 | “创建 Google Checkout 账户” |
2x3 | 180 | “创建 Google Checkout 账户” | “创建 Google Checkout 账户” | 488 |
3x1 | “‘设备键盘设置’屏幕” | 488 | 64 | 120 |
3x2 | “使用计算器” | 488 | 184 | “创建 Google Checkout 账户” |
3x3 | “使用计算器” | 488 | “创建 Google Checkout 账户” | 488 |
3x4 | “使用计算器” | 488 | 424 | 672 |
断点
断点对于构建可适应、方便易用的可调整大小文件至关重要 微件。通过测试设计,你可以确定布局尺寸方面的阈值 调整。实现断点以触发这些更改 确保您的 widget 在任何尺寸下都能保持视觉吸引力和功能。
断点还可让您灵活地有条件地包含或排除 补充内容,根据 widget 的布局来优化空间利用率 维度。
<ph type="x-smartling-placeholder">![](https://developer.android.google.cn/static/images/design/ui/mobile/widgets/01_Breakpoints.jpg?authuser=19&hl=lv)
填满边界
用户移除微件的主要原因是:微件与微件 其他主屏幕元素为防止出现这种情况,请确保 widget 始终填满其 完全分配的网格空间。
![](https://developer.android.google.cn/static/images/design/ui/mobile/widgets/01_Fill_the_Bounds.jpg?authuser=19&hl=lv)
正确做法
确保容器以各种尺寸完全拉伸。
![](https://developer.android.google.cn/static/images/design/ui/mobile/widgets/02_Fill_the_Bounds.jpg?authuser=19&hl=lv)
错误做法
添加自定义内边距。您的 widget 应无缝衔接。
![](https://developer.android.google.cn/static/images/design/ui/mobile/widgets/03_Fill_the_Bounds.jpg?authuser=19&hl=lv)
正确做法
确保非矩形形状在纵轴或横轴上与网格相接,以实现视觉一致性。
![](https://developer.android.google.cn/static/images/design/ui/mobile/widgets/04_Fill_the_Bounds.jpg?authuser=19&hl=lv)
错误做法
使用固定的正方形。而应使用可适应各种网格尺寸的响应式矩形容器。