File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
wear/src/main/java/com/example/wear/snippets/m3/tile Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package com.example.wear.snippets.m3.tile
1919import android.content.Context
2020import androidx.wear.protolayout.ResourceBuilders.Resources
2121import androidx.wear.protolayout.TimelineBuilders.Timeline
22+ import androidx.wear.protolayout.material3.MaterialScope
2223import androidx.wear.protolayout.material3.Typography.BODY_LARGE
2324import androidx.wear.protolayout.material3.button
2425import androidx.wear.protolayout.material3.buttonGroup
@@ -124,12 +125,15 @@ class TileBreakpoints : TileService() {
124125 )
125126}
126127
128+ fun MaterialScope.myAdaptiveLayout () =
129+ primaryLayout(mainSlot = { text(" Hello, World" .layoutString) })
130+
127131// [START android_wear_tile_preview]
128132@Preview(device = WearDevices .LARGE_ROUND )
129133fun smallPreview (context : Context ) = TilePreviewData {
130134 TilePreviewHelper .singleTimelineEntryTileBuilder(
131135 materialScope(context, it.deviceConfiguration) {
132- primaryLayout(mainSlot = { text( " Hello, World " .layoutString) })
136+ myAdaptiveLayout() // varies the layout depending on the size of the screen
133137 }
134138 )
135139 .build()
You can’t perform that action at this time.
0 commit comments