다양한 시계 모양 처리
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Compose 사용해 보기
Wear OS용 Jetpack Compose는 Wear OS에 권장되는 UI 도구 키트입니다.
Wear OS에서 실행되는 앱은 다른 Android 기기와 동일한 레이아웃 기법을 사용하지만 시계별 제약 조건으로 디자인해야 합니다.
참고: 모바일 앱의 기능과 UI를 똑같이 Wear OS로 포팅하면 우수한 사용자 환경을 기대하기 어렵습니다.
직사각형 휴대기기에 맞게 앱을 디자인하면 원형 시계에서 화면 모서리 근처의 콘텐츠가 잘릴 수 있습니다. 스크롤 가능한 세로 목록을 사용하는 경우에는 크게 문제가 되지 않습니다. 사용자가 콘텐츠를 가운데로 스크롤할 수 있기 때문입니다. 하지만 단일 화면의 경우 사용자 환경이 저하될 수 있습니다.
다음 레이아웃 설정을 사용하면 텍스트가 원형 화면 기기에서 올바르게 표시되지 않습니다.
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="@string/very_long_hello_world"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
이 문제를 해결하려면 원형 기기를 지원하는
Wear OS UI 라이브러리의 레이아웃을 사용합니다.
앱 디자인에 관한 자세한 내용은
Wear OS 디자인 가이드라인을 참고하세요.
BoxInsetLayout 사용
그림 2. 원형 화면의 창 인셋
Wear OS UI 라이브러리의
BoxInsetLayout
클래스를 사용하면 원형 화면에서 작동하는 레이아웃을 정의할 수 있습니다. 이 클래스를 사용하면 화면의 중앙이나 가장자리 근처에 뷰를 쉽게 정렬할 수 있습니다.
그림 2의 회색 정사각형은 필수 창 인셋을 적용한 후 BoxInsetLayout
이 원형 화면에 하위 뷰를 자동으로 배치할 수 있는 영역을 나타냅니다. 이 영역 내에 표시되도록 하위 뷰는 다음 값으로 layout_boxedEdges
속성을 지정합니다.
top
, bottom
, left
, right
를 조합하여 사용합니다. 예를 들어 "left|top"
값은 하위 뷰의 왼쪽 및 상단 가장자리를 그림 2의 회색 정사각형 내부에 배치합니다.
"all"
값은 모든 하위 뷰의 콘텐츠를 그림 2의 회색 정사각형 내부에 배치합니다. 이는 ConstraintLayout
이 내부에 있는 가장 일반적인 접근 방식입니다.
그림 2의 레이아웃은 <BoxInsetLayout>
요소를 사용하며 원형 화면에서 작동합니다.
<androidx.wear.widget.BoxInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:padding="15dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
app:layout_boxedEdges="all">
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/sometext"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:background="@android:color/transparent"
android:layout_height="50dp"
android:layout_width="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:src="@drawable/cancel" />
<ImageButton
android:background="@android:color/transparent"
android:layout_height="50dp"
android:layout_width="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/ok" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.wear.widget.BoxInsetLayout>
굵게 표시된 레이아웃 부분을 확인하세요.
-
android:padding="15dp"
이 줄은 <BoxInsetLayout>
요소에 패딩을 할당합니다.
-
android:padding="5dp"
이 줄은 내부 ConstraintLayout
요소에 패딩을 할당합니다.
-
app:layout_boxedEdges="all"
이 줄은 ConstraintLayout
요소 및 하위 요소가 원형 화면의 창 인셋에 의해 정의된 영역 내부에서 상자로 표시되도록 합니다.
곡선형 레이아웃 사용
Wear OS UI 라이브러리의
WearableRecyclerView
클래스를 사용하면 원형 화면에 최적화된 곡선형 레이아웃을 선택할 수 있습니다.
앱에서 스크롤 가능한 목록에 곡선형 레이아웃을 사용 설정하려면
Wear OS에서 목록 만들기를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-26(UTC)"],[],[],null,["# Handle different watch shapes\n\nTry the Compose way \nJetpack Compose on Wear OS is the recommended UI toolkit for Wear OS. \n[Try Compose on Wear OS →](/training/wearables/compose) \n\n\nApps on Wear OS use the same layout techniques as other Android devices\nbut need to be designed with watch-specific constraints.\n\n\n**Note:** Don't port the exact functionality and UI from a mobile app to Wear OS and expect\na good user experience.\n\n\nIf you design your app for a rectangular handheld device, content near the corners of the screen\nmight be cropped on round watches. If you are using a scrollable vertical list, this is less of\nan issue, as the user can scroll to center the content. However, for single screens, it can\nprovide a bad user experience.\n\n\nIf you use the following settings for your layout, text displays incorrectly on devices\nwith round screens: \n\n```xml\n\u003candroidx.constraintlayout.widget.ConstraintLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\u003e\n\n \u003cTextView\n android:id=\"@+id/text\"\n android:layout_width=\"0dp\"\n android:layout_height=\"0dp\"\n android:text=\"@string/very_long_hello_world\"\n app:layout_constraintBottom_toBottomOf=\"parent\"\n app:layout_constraintEnd_toEndOf=\"parent\"\n app:layout_constraintStart_toStartOf=\"parent\"\n app:layout_constraintTop_toTopOf=\"parent\" /\u003e\n\n\u003c/androidx.constraintlayout.widget.ConstraintLayout\u003e\n```\n\n\nTo solve this problem, use layouts in the [Wear OS UI Library](/training/wearables/views) that support round devices.\n\n- You can use a [`BoxInsetLayout`](/reference/androidx/wear/widget/BoxInsetLayout) to prevent views from being cropped near the edges of round screens.\n- You can use a [WearableRecyclerView](/reference/androidx/wear/widget/WearableRecyclerView) to create a curved layout when you want to display and manipulate a vertical list of items optimized for round screens.\n\n\nFor more information about designing apps, read the\n[Wear OS design guidelines](/training/wearables/design).\n\nUse a BoxInsetLayout\n--------------------\n\n\n**Figure 2.** Window insets on a round screen.\n\n\nThe [`BoxInsetLayout`](/reference/androidx/wear/widget/BoxInsetLayout) class in the Wear OS UI Library lets\nyou define a layout that works for round screens. This class lets you\neasily align views on the center or near the edges of the screen.\n\n\nThe gray square in figure 2 shows the area where the `BoxInsetLayout`\ncan automatically place its child views on round screens after applying\nthe required window insets. To be displayed inside this area, child\nviews specify the `layout_boxedEdges` attribute with the following values:\n\n- A combination of `top`, `bottom`, `left`, and `right`. For example, a `\"left|top\"` value positions the child's left and top edges inside the gray square in figure 2.\n- The `\"all\"` value positions all the child's content inside the gray square in figure 2. This is the most common approach with a [`ConstraintLayout`](/reference/androidx/constraintlayout/widget/ConstraintLayout) inside.\n\n\nThe layout shown in figure 2 uses the `\u003cBoxInsetLayout\u003e`\nelement and works on round screens: \n\n```xml\n\u003candroidx.wear.widget.BoxInsetLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n android:layout_height=\"match_parent\"\n android:layout_width=\"match_parent\"\n android:padding=\"15dp\"\u003e\n\n \u003candroidx.constraintlayout.widget.ConstraintLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:padding=\"5dp\"\n app:layout_boxedEdges=\"all\"\u003e\n\n \u003cTextView\n android:layout_height=\"wrap_content\"\n android:layout_width=\"match_parent\"\n android:text=\"@string/sometext\"\n android:textAlignment=\"center\"\n app:layout_constraintEnd_toEndOf=\"parent\"\n app:layout_constraintStart_toStartOf=\"parent\"\n app:layout_constraintTop_toTopOf=\"parent\" /\u003e\n\n \u003cImageButton\n android:background=\"@android:color/transparent\"\n android:layout_height=\"50dp\"\n android:layout_width=\"50dp\"\n app:layout_constraintBottom_toBottomOf=\"parent\"\n app:layout_constraintStart_toStartOf=\"parent\"\n android:src=\"@drawable/cancel\" /\u003e\n\n \u003cImageButton\n android:background=\"@android:color/transparent\"\n android:layout_height=\"50dp\"\n android:layout_width=\"50dp\"\n app:layout_constraintBottom_toBottomOf=\"parent\"\n app:layout_constraintEnd_toEndOf=\"parent\"\n android:src=\"@drawable/ok\" /\u003e\n\n \u003c/androidx.constraintlayout.widget.ConstraintLayout\u003e\n\n\u003c/androidx.wear.widget.BoxInsetLayout\u003e\n```\n\n\nNotice the parts of the layout marked in bold:\n\n-\n `android:padding=\"15dp\"`\n\n\n This line assigns padding to the `\u003cBoxInsetLayout\u003e`\n element.\n-\n `android:padding=\"5dp\"`\n\n\n This line assigns padding to the inner `ConstraintLayout` element.\n-\n `app:layout_boxedEdges=\"all\"`\n\n\n This line ensures that the `ConstraintLayout` element\n and its children are boxed inside the area defined by the window\n insets on round screens.\n\nUse a curved layout\n-------------------\n\nThe [WearableRecyclerView](/reference/androidx/wear/widget/WearableRecyclerView) class in the Wear OS UI Library\nlets you opt-in to a curved layout optimized for round screens.\nTo enable a curved layout for scrollable lists in your\napp, see [Create lists on Wear OS](/training/wearables/ui/lists#creating)."]]