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
19
19
import android.content.Context
20
20
import androidx.wear.protolayout.ResourceBuilders.Resources
21
21
import androidx.wear.protolayout.TimelineBuilders.Timeline
22
+ import androidx.wear.protolayout.material3.MaterialScope
22
23
import androidx.wear.protolayout.material3.Typography.BODY_LARGE
23
24
import androidx.wear.protolayout.material3.button
24
25
import androidx.wear.protolayout.material3.buttonGroup
@@ -124,12 +125,15 @@ class TileBreakpoints : TileService() {
124
125
)
125
126
}
126
127
128
+ fun MaterialScope.myAdaptiveLayout () =
129
+ primaryLayout(mainSlot = { text(" Hello, World" .layoutString) })
130
+
127
131
// [START android_wear_tile_preview]
128
132
@Preview(device = WearDevices .LARGE_ROUND )
129
133
fun smallPreview (context : Context ) = TilePreviewData {
130
134
TilePreviewHelper .singleTimelineEntryTileBuilder(
131
135
materialScope(context, it.deviceConfiguration) {
132
- primaryLayout(mainSlot = { text( " Hello, World " .layoutString) })
136
+ myAdaptiveLayout() // varies the layout depending on the size of the screen
133
137
}
134
138
)
135
139
.build()
You can’t perform that action at this time.
0 commit comments