목록을 사용하면 사용자는 Wear OS 기기에서 여러 선택 항목 중 하나를 고를 수 있습니다.
많은 Wear OS 기기가 원형 화면을 사용하므로 화면의 상단과 하단 근처에 표시되는 목록 항목을 보기가 어렵습니다. 이러한 이유로 Wear OS용 Compose에는 크기 조정 및 모핑 애니메이션을 지원하는 TransformingLazyColumn이라는 LazyColumn 클래스의 한 가지 버전이 포함되어 있습니다.
항목이 가장자리로 이동하면 항목이 작아지고 흐려집니다.
확대/축소 및 스크롤 효과를 추가하려면 Modifier.transformedHeight를 사용하여 항목이 화면을 스크롤할 때 Compose가 높이 변화를 계산하도록 하고 transformation = SurfaceTransformation(transformationSpec)를 사용하여 이전 항목과 일치하도록 항목을 시각적으로 축소하는 등 시각 효과를 적용합니다.
transformation를 매개변수로 사용하지 않는 구성요소(예: Text)에는 맞춤 TransformationSpec를 사용합니다.
다음 애니메이션은 요소가 화면에서 움직일 때 크기와 투명도가 어떻게 변경되는지 보여줍니다.
다음 코드 스니펫은 TransformingLazyColumn 레이아웃을 사용하여 다양한 Wear OS 화면 크기에서 보기 좋은 콘텐츠를 만드는 방법을 보여줍니다. 예를 들어 다음 샘플 코드에서는 TransformingLazyColumn의 contentPadding에 설정된 목록의 첫 번째 요소와 마지막 요소에 필요한 패딩을 추가합니다. 스크롤 표시기가 표시되려면 ScreenScaffold와 TransformingLazyColumn 사이에 columnState를 공유해야 합니다.
valcolumnState=rememberTransformingLazyColumnState()valcontentPadding=rememberResponsiveColumnPadding(first=ColumnItemType.ListHeader,last=ColumnItemType.Button,)valtransformationSpec=rememberTransformationSpec()ScreenScaffold(scrollState=columnState,contentPadding=contentPadding){contentPadding->
TransformingLazyColumn(state=columnState,contentPadding=contentPadding){item{ListHeader(modifier=Modifier.fillMaxWidth().transformedHeight(this,transformationSpec),transformation=SurfaceTransformation(transformationSpec)){Text(text="Header")}}// ... other itemsitem{Button(modifier=Modifier.fillMaxWidth().transformedHeight(this,transformationSpec),transformation=SurfaceTransformation(transformationSpec),onClick={/* ... */},icon={Icon(imageVector=Icons.Default.Build,contentDescription="build",)},){Text(text="Build",maxLines=1,overflow=TextOverflow.Ellipsis,)}}}}
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-23(UTC)
[null,null,["최종 업데이트: 2025-08-23(UTC)"],[],[],null,["Compose for Wear OS Material version 2.5 3\n\n*** ** * ** ***\n\nLists let users select an item from a set of choices on Wear OS devices.\n\n\nMany Wear OS devices use round screens, which makes it more difficult to see\nlist items that appear near the top and bottom of the screen. For this reason,\nCompose for Wear OS includes a version of the `LazyColumn` class called\n[`TransformingLazyColumn`](/reference/kotlin/androidx/wear/compose/foundation/lazy/package-summary?#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,kotlin.Function1)), which supports scaling and morphing animations.\nWhen items move to the edges, they get smaller and fade out.\n\nIn order to add a scaling and scrolling effect, use `Modifier.transformedHeight`\nto allow Compose to calculate the height change as the item scrolls through the\nscreen and `transformation = SurfaceTransformation(transformationSpec)` to apply\nthe visual effects, including scaling down the item visually to match the\nprevious.\nUse a custom [`TransformationSpec`](/reference/kotlin/androidx/wear/compose/material3/lazy/TransformationSpec) for components which don't take\n`transformation` as a parameter, for example `Text`.\n\n\nThe following animation shows how an element's size and transparency changes as\nit moves along the screen:\n\nThe following code snippet shows how to create a list using [`TransformingLazyColumn`](/reference/kotlin/androidx/wear/compose/foundation/lazy/package-summary?#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,kotlin.Function1)) layout to create content that [looks great on a variety of Wear OS screen sizes](/training/wearables/compose/screen-size), for example in the following sample code, it will add the necessary padding to the first and last elements of the list which are set in the `contentPadding` of the `TransformingLazyColumn`. In order for the scroll indicator to be shown, share the `columnState` between the `ScreenScaffold` and the `TransformingLazyColumn`:\n\n\u003cbr /\u003e\n\n```kotlin\nval columnState = rememberTransformingLazyColumnState()\nval contentPadding = rememberResponsiveColumnPadding(\n first = ColumnItemType.ListHeader,\n last = ColumnItemType.Button,\n)\nval transformationSpec = rememberTransformationSpec()\nScreenScaffold(\n scrollState = columnState,\n contentPadding = contentPadding\n) { contentPadding -\u003e\n TransformingLazyColumn(\n state = columnState,\n contentPadding = contentPadding\n ) {\n item {\n ListHeader(\n modifier = Modifier.fillMaxWidth().transformedHeight(this, transformationSpec),\n transformation = SurfaceTransformation(transformationSpec)\n ) {\n Text(text = \"Header\")\n }\n }\n // ... other items\n item {\n Button(\n modifier = Modifier.fillMaxWidth().transformedHeight(this, transformationSpec),\n transformation = SurfaceTransformation(transformationSpec),\n onClick = { /* ... */ },\n icon = {\n Icon(\n imageVector = Icons.Default.Build,\n contentDescription = \"build\",\n )\n },\n ) {\n Text(\n text = \"Build\",\n maxLines = 1,\n overflow = TextOverflow.Ellipsis,\n )\n }\n }\n }\n}https://github.com/android/snippets/blob/5673ffc60b614daf028ee936227128eb8c4f9781/wear/src/main/java/com/example/wear/snippets/m3/list/List.kt#L53-L96\n```\n\nAdd a snap-and-fling effect If you need to add a snap-and-fling behavior, we suggest to use `ScalingLazyColumn`. This effect helps users more precisely navigate through the items in a list while also helping them move more quickly through a long list.\n\nTo add this effect to the Horologist's version of the [`ScalingLazyColumn`](https://google.github.io/horologist/compose-layout/),\nset the `rotaryMode` parameter of `columnState` to\n[`RotaryWithSnap`](https://google.github.io/horologist/api/compose-layout/com.google.android.horologist.compose.rotaryinput/rotary-with-snap.html), as shown in the following code snippet: \n\n```kotlin\nval columnState = rememberResponsiveColumnState(\n // ...\n // ...\n rotaryMode = ScalingLazyColumnState.RotaryMode.Snap\n)\nScreenScaffold(scrollState = columnState) {\n ScalingLazyColumn(\n columnState = columnState\n ) {\n // ...\n // ...\n }\n}https://github.com/android/snippets/blob/5673ffc60b614daf028ee936227128eb8c4f9781/wear/src/main/java/com/example/wear/snippets/list/List.kt#L72-L103\n```\n\nRecommended for you\n\n- Note: link text is displayed when JavaScript is off\n- [Compose for Wear OS Codelab](/codelabs/compose-for-wear-os)\n- [Lists and Grids](/develop/ui/compose/lists)\n- [Using Views in Compose](/develop/ui/compose/migrate/interoperability-apis/views-in-compose)"]]