TV 앱에서 TalkBack 지원
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
TV 앱에는
TalkBack으로 앱 사용 이러한 사용자에게 더 나은 TalkBack 환경을 제공하기 위해
이 가이드의 각 섹션을 검토하고
사용할 수 있습니다. 앱에서 맞춤 뷰를 사용하는 경우
맞춤 API로 접근성을 지원하는 방법을 설명하는 해당하는 가이드
할 수 있습니다.
중첩 뷰 처리
중첩된 뷰는 TalkBack 사용자가 탐색하기 어려울 수 있습니다. 가능하면 항상
TalkBack으로 포커스할 수 있는 상위 뷰나 하위 뷰를 둘 다 지원할 수는 없습니다.
TalkBack에서 보기를 포커스 가능하게 설정하려면 focusable
및
focusableInTouchMode
속성을 true
로 설정합니다. 이 단계가 필요한 이유는
일부 TV 기기의 경우 TalkBack이 활성화되어 있는 동안 터치 모드를 시작하고 종료할 수 있습니다.
뷰에 포커스 불가능을 만들려면 focusable
를 설정하기만 하면 됩니다.
속성을 false
로 설정합니다. 그러나 조회 가능한 경우 (즉,
해당 AccessibilityNodeInfo
에 ACTION_CLICK
가 있음) 여전히
포커스 가능합니다
작업 설명 변경
기본적으로 TalkBack에서 '선택을 눌러 활성화'라고 알려줍니다. 활용 가능한 보기를 만들 수 있습니다.
일부 작업의 경우 '활성화'라는 용어 좋은 설명이 아닐 수 있습니다 받는사람
더 정확한 설명을 입력하면 됩니다.
Kotlin
findViewById<View>(R.id.custom_actionable_view).accessibilityDelegate = object : View.AccessibilityDelegate() {
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(host, info)
info.addAction(
AccessibilityAction(
AccessibilityAction.ACTION_CLICK.id,
getString(R.string.custom_label)
)
)
}
}
자바
findViewById(R.id.custom_actionable_view).setAccessibilityDelegate(new AccessibilityDelegate() {
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
AccessibilityAction action = new AccessibilityAction(
AccessibilityAction.ACTION_CLICK.getId(), getString(R.string.custom_label));
info.addAction(action);
}
});
슬라이더 지원 추가
TV의 TalkBack은 특별히 슬라이더를 지원합니다. 슬라이더 모드를 사용 설정하려면
RangeInfo
객체와 함께 뷰에 ACTION_SET_PROGRESS
을 추가합니다.
사용자가 TV 리모컨의 가운데 버튼을 눌러 슬라이더 모드로 전환합니다.
이 모드에서 화살표 버튼을 누르면 ACTION_SCROLL_FORWARD
이 생성되고
ACTION_SCROLL_BACKWARD
접근성 작업
다음 예에서는 1~10 사이의 볼륨 슬라이더를 구현합니다.
Kotlin
/**
* This example only provides slider functionality for TalkBack users. Additional logic should
* be added for other users. Such logic may reuse the increase and decrease methods.
*/
class VolumeSlider(context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {
private val min = 1
private val max = 10
private var current = 5
private var textView: TextView? = null
init {
isFocusable = true
isFocusableInTouchMode = true
val rangeInfo =
AccessibilityNodeInfo.RangeInfo(
AccessibilityNodeInfo.RangeInfo.RANGE_TYPE_INT,
min.toFloat(),
max.toFloat(),
current.toFloat()
)
accessibilityDelegate =
object : AccessibilityDelegate() {
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(host, info)
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_PROGRESS)
info.rangeInfo = rangeInfo
}
override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD.id) {
increase()
return true
}
if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD.id) {
decrease()
return true
}
return super.performAccessibilityAction(host, action, args)
}
}
}
override fun onFinishInflate() {
super.onFinishInflate()
textView = findViewById(R.id.text)
textView!!.text = context.getString(R.string.level, current)
}
private fun increase() {
update((current + 1).coerceAtMost(max))
}
private fun decrease() {
update((current - 1).coerceAtLeast(min))
}
private fun update(newLevel: Int) {
if (textView == null) {
return
}
val newText = context.getString(R.string.level, newLevel)
// Update the user interface with the new volume.
textView!!.text = newText
// Announce the new volume.
announceForAccessibility(newText)
current = newLevel
}
}
Java
/**
* This example only provides slider functionality for TalkBack users. Additional logic should
* be added for other users. Such logic can reuse the increase and decrease methods.
*/
public class VolumeSlider extends LinearLayout {
private final int min = 1;
private final int max = 10;
private int current = 5;
private TextView textView;
public VolumeSlider(Context context, AttributeSet attrs) {
super(context, attrs);
setFocusable(true);
setFocusableInTouchMode(true);
RangeInfo rangeInfo = new RangeInfo(RangeInfo.RANGE_TYPE_INT, min, max, current);
setAccessibilityDelegate(
new AccessibilityDelegate() {
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
info.addAction(AccessibilityAction.ACTION_SET_PROGRESS);
info.setRangeInfo(rangeInfo);
}
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (action == AccessibilityAction.ACTION_SCROLL_FORWARD.getId()) {
increase();
return true;
}
if (action == AccessibilityAction.ACTION_SCROLL_BACKWARD.getId()) {
decrease();
return true;
}
return super.performAccessibilityAction(host, action, args);
}
});
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
textView = findViewById(R.id.text);
textView.setText(getContext().getString(R.string.level, current));
}
private void increase() {
update(Math.min(current + 1, max));
}
private void decrease() {
update(Math.max(current - 1, min));
}
private void update(int newLevel) {
if (textView == null) {
return;
}
String newText = getContext().getString(R.string.level, newLevel);
// Update the user interface with the new volume.
textView.setText(newText);
// Announce the new volume.
announceForAccessibility(newText);
current = newLevel;
}
}
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Support TalkBack in TV apps\n\nTV apps sometimes have use cases that make it difficult for users who rely on\n[TalkBack](/guide/topics/ui/accessibility/testing#talkback) to use the app. To provide a better TalkBack experience for these\nusers, review each of the sections in this guide and implement changes in your\napp where necessary. If your app uses custom views, you should also refer to the\n[corresponding guide](/training/tv/accessibility/custom-views) that describes how to support accessibility with custom\nviews.\n\nHandle nested views\n-------------------\n\nNested views can be hard for TalkBack users to navigate. Whenever possible, make\neither the parent or the child view focusable by TalkBack, but not both.\n\nTo make a view focusable by TalkBack, set the [`focusable`](/reference/android/view/View#attr_android:focusable) and the\n[`focusableInTouchMode`](/reference/android/view/View#attr_android:focusableInTouchMode) attribute to `true`. This step is necessary because\nsome TV devices might enter and exit touch mode while TalkBack is active.\n\nTo make a view non-focusable, it is sufficient to set the [`focusable`](/reference/android/view/View#attr_android:focusable)\nattribute to `false`. However, if the view is actionable (that is, its\ncorresponding `AccessibilityNodeInfo` has [`ACTION_CLICK`](/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction#ACTION_CLICK)), it might still\nbe focusable.\n\nChange descriptions for Actions\n-------------------------------\n\nBy default, TalkBack announces \"Press select to activate\" for actionable views.\nFor some actions, the term \"activate\" might not be a good description. To\nprovide a more accurate description, you can change it: \n\n### Kotlin\n\n```kotlin\nfindViewById\u003cView\u003e(R.id.custom_actionable_view).accessibilityDelegate = object : View.AccessibilityDelegate() {\n override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {\n super.onInitializeAccessibilityNodeInfo(host, info)\n info.addAction(\n AccessibilityAction(\n AccessibilityAction.ACTION_CLICK.id,\n getString(R.string.custom_label)\n )\n )\n }\n}\n```\n\n### Java\n\n```java\nfindViewById(R.id.custom_actionable_view).setAccessibilityDelegate(new AccessibilityDelegate() {\n @Override\n public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {\n super.onInitializeAccessibilityNodeInfo(host, info);\n AccessibilityAction action = new AccessibilityAction(\n AccessibilityAction.ACTION_CLICK.getId(), getString(R.string.custom_label));\n info.addAction(action);\n }\n});\n```\n\nAdd support for sliders\n-----------------------\n\nTalkBack on TV has special support for sliders. To enable slider mode, add\n[`ACTION_SET_PROGRESS`](/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction#ACTION_SET_PROGRESS) to a view together with a [`RangeInfo`](/reference/android/view/accessibility/AccessibilityNodeInfo.RangeInfo) object.\n\nThe user enters the slider mode by pressing the center button of the TV remote.\nIn this mode, the arrow buttons generate [`ACTION_SCROLL_FORWARD`](/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_FORWARD) and\n[`ACTION_SCROLL_BACKWARD`](/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_BACKWARD) accessibility actions.\n\nThe following example implements a volume slider with levels from 1 to 10: \n\n### Kotlin\n\n```kotlin\n/**\n * This example only provides slider functionality for TalkBack users. Additional logic should\n * be added for other users. Such logic may reuse the increase and decrease methods.\n */\nclass VolumeSlider(context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {\n private val min = 1\n private val max = 10\n private var current = 5\n private var textView: TextView? = null\n\n init {\n isFocusable = true\n isFocusableInTouchMode = true\n val rangeInfo =\n AccessibilityNodeInfo.RangeInfo(\n AccessibilityNodeInfo.RangeInfo.RANGE_TYPE_INT,\n min.toFloat(),\n max.toFloat(),\n current.toFloat()\n )\n accessibilityDelegate =\n object : AccessibilityDelegate() {\n override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {\n super.onInitializeAccessibilityNodeInfo(host, info)\n info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_PROGRESS)\n info.rangeInfo = rangeInfo\n }\n\n override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {\n if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD.id) {\n increase()\n return true\n }\n if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD.id) {\n decrease()\n return true\n }\n return super.performAccessibilityAction(host, action, args)\n }\n }\n }\n\n override fun onFinishInflate() {\n super.onFinishInflate()\n textView = findViewById(R.id.text)\n textView!!.text = context.getString(R.string.level, current)\n }\n\n private fun increase() {\n update((current + 1).coerceAtMost(max))\n }\n\n private fun decrease() {\n update((current - 1).coerceAtLeast(min))\n }\n\n private fun update(newLevel: Int) {\n if (textView == null) {\n return\n }\n val newText = context.getString(R.string.level, newLevel)\n // Update the user interface with the new volume.\n textView!!.text = newText\n // Announce the new volume.\n announceForAccessibility(newText)\n current = newLevel\n }\n}\n```\n\n### Java\n\n```java\n/**\n * This example only provides slider functionality for TalkBack users. Additional logic should\n * be added for other users. Such logic can reuse the increase and decrease methods.\n */\npublic class VolumeSlider extends LinearLayout {\n private final int min = 1;\n private final int max = 10;\n private int current = 5;\n private TextView textView;\n\n public VolumeSlider(Context context, AttributeSet attrs) {\n super(context, attrs);\n setFocusable(true);\n setFocusableInTouchMode(true);\n RangeInfo rangeInfo = new RangeInfo(RangeInfo.RANGE_TYPE_INT, min, max, current);\n setAccessibilityDelegate(\n new AccessibilityDelegate() {\n @Override\n public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {\n super.onInitializeAccessibilityNodeInfo(host, info);\n info.addAction(AccessibilityAction.ACTION_SET_PROGRESS);\n info.setRangeInfo(rangeInfo);\n }\n\n @Override\n public boolean performAccessibilityAction(View host, int action, Bundle args) {\n if (action == AccessibilityAction.ACTION_SCROLL_FORWARD.getId()) {\n increase();\n return true;\n }\n if (action == AccessibilityAction.ACTION_SCROLL_BACKWARD.getId()) {\n decrease();\n return true;\n }\n return super.performAccessibilityAction(host, action, args);\n }\n });\n }\n\n @Override\n protected void onFinishInflate() {\n super.onFinishInflate();\n textView = findViewById(R.id.text);\n textView.setText(getContext().getString(R.string.level, current));\n }\n\n private void increase() {\n update(Math.min(current + 1, max));\n }\n\n private void decrease() {\n update(Math.max(current - 1, min));\n }\n\n private void update(int newLevel) {\n if (textView == null) {\n return;\n }\n String newText = getContext().getString(R.string.level, newLevel);\n // Update the user interface with the new volume.\n textView.setText(newText);\n // Announce the new volume.\n announceForAccessibility(newText);\n current = newLevel;\n }\n}\n```"]]