[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Develop tiles for different screen sizes\n\nTiles for Wear OS version 2.5 3\n\n*** ** * ** ***\n\nYour app's tiles should work well on Wear OS devices of all sizes, taking\nadvantage of additional space where available, and still look great on smaller\nscreens too. This guide provides recommendations for achieving this user\nexperience.\n\nTo learn more about the design principles for adaptive layouts, read the\n[design guidance](/design/ui/wear/guides/foundations/adaptive-layouts).\n\nBuild responsive layouts using ProtoLayout\n------------------------------------------\n\nThe [ProtoLayout Material](/reference/androidx/wear/protolayout/material/layouts/package-summary) library provides predefined layouts to help you\nbuild your tiles. These layouts are already designed to adapt to the screen\nsize.\n\nRefer to the [Figma design layouts](/downloads/design/material-2-5-tiles-wear-os-design-kit-v2-3.fig), which demonstrate the canonical\nlayouts available and how to build your design using them:\n\n- [`PrimaryLayout`](/reference/androidx/wear/protolayout/material/layouts/PrimaryLayout)\n- [`EdgeContentLayout`](/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout)\n- [`MultiButtonLayout`](/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout)\n- [`MultiSlotLayout`](/reference/androidx/wear/protolayout/material/layouts/MultiSlotLayout)\n\nWe recommend [`PrimaryLayout`](/reference/androidx/wear/protolayout/material/layouts/PrimaryLayout) or [`EdgeContentLayout`](/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout) as top-level\nlayouts for most use cases. Set the responsive behavior using\n`setResponsiveContentInsetEnabled`, for example: \n\n PrimaryLayout.Builder(deviceParameters)\n .setResponsiveContentInsetEnabled(true)\n .setContent(\n // ...\n )\n .build()\n\nProvide differentiated experiences through breakpoints\n------------------------------------------------------\n\nLayouts from the [ProtoLayout Material](/reference/androidx/wear/protolayout/material/layouts/package-summary) library are already responsive and\ntake care of correct element placement and visibility. However, in some cases\nyou might want to vary the number of visible elements for best results. For\nexample, you might want 3 buttons on a smaller display, and 5 on a larger\ndisplay.\n\nTo implement this sort of differentiated experience, use *screen size\nbreakpoints*. To show a different layout when the screen size exceeds 225 dp: \n\n materialScope(context, deviceConfiguration) {\n primaryLayout(\n mainSlot = {\n buttonGroup {\n buttonGroupItem { button1 }\n buttonGroupItem { button2 }\n buttonGroupItem { button3 }\n if (deviceConfiguration.screenHeightDp \u003e= 225) {\n buttonGroupItem { button4 }\n buttonGroupItem { button5 }\n }\n }\n }\n )\n }\n\nThe [design guidance](/design/ui/wear/guides/foundations/adaptive-layouts) illustrates additional opportunities.\n\nTest tiles on different screen sizes using Previews\n---------------------------------------------------\n\nIt is important to test your layouts on different screen sizes. Use the\nTile Preview annotations, along with the [`TilePreviewHelper`](/reference/androidx/wear/tiles/tooling/preview/TilePreviewHelper) and\n[`TilePreviewData`](/reference/androidx/wear/tiles/tooling/preview/TilePreviewData) classes: \n\n @Preview(device = WearDevices.LARGE_ROUND)\n fun smallPreview(context: Context) = TilePreviewData(\n onTileRequest = { request -\u003e\n TilePreviewHelper.singleTimelineEntryTileBuilder(\n buildLayout()\n ).build()\n }\n )\n\nThis lets you preview your Tile layouts directly within Android Studio. The\nprevious [breakpoints](#breakpoints) example illustrates how additional buttons\nare shown when the screen space allows, when previewed: \n\n*Small and large displays showing the effect of the breakpoint*\n\nFor a full example, see the [media tiles sample](https://github.com/android/wear-os-samples/blob/66fd43b09cc12b26c9f8cc11ea45d97e3733761d/WearTilesKotlin/app/src/debug/java/com/example/wear/tiles/golden/Media.kt) on GitHub."]]