Sistem altyazı ayarlarını kullanın
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Android TV'de ayarlar, kullanıcıların kendi altyazı stillerini tanımlamaları için sağlanır.
Bu kılavuzda, bir uygulamanın sistem tarafından sağlanan bilgileri nasıl edinebileceği ve
altyazı stili.
Altyazı seçeneklerini şurada bulabilirsiniz: Ayarlar > Sistem > Erişilebilirlik > Açıklama metni:

CaptioningManager'ı edinme
Bir etkinlikten altyazı hizmetini şuradan alabilirsiniz: Context
CaptioningManager
:
CaptioningManager captioningManager = (CaptioningManager)context.getSystemService(Context.CAPTIONING_SERVICE);
Altyazı stili değişikliklerini işleme
Ardından CaptioningChangeListener
uygulayarak altyazı stilindeki değişiklikleri yapabilirsiniz:
if (captioningManager != null) {
// Define a class to store the CaptionStyle details.
CurrentCaptionStyle currentCaptionStyle = new CurrentCaptionStyle;
// Define the listeners.
captioningManager.addCaptioningChangeListener(new CaptioningChangeListener() {
@Override
public void onEnabledChanged(boolean enabled) {
super.onEnabledChanged(enabled);
Log.d(TAG, "onEnabledChanged");
currentCaptionStyle.isEnabled = enabled;
}
@Override
public void onLocaleChanged(@Nullable Locale locale) {
super.onLocaleChanged(locale);
Log.d(TAG, "onLocaleChanged");
currentCaptionStyle.locale = locale;
}
@Override
public void onFontScaleChanged(float fontScale) {
super.onFontScaleChanged(fontScale);
Log.d(TAG, "onFontScaleChanged");
currentCaptionStyle.fontScale = fontScale;
}
@Override
public void onUserStyleChanged(@NonNull CaptionStyle userStyle) {
super.onUserStyleChanged(userStyle);
Log.d(TAG, "onUserStyleChanged");
currentCaptionStyle.hasBackgroundColor = userStyle.hasBackgroundColor();
currentCaptionStyle.backgroundColor = userStyle.backgroundColor;
currentCaptionStyle.backgroundOpcity = userStyle.backgroundColor >>> 24;
currentCaptionStyle.hasForegroundColor = userStyle.hasForegroundColor();
currentCaptionStyle.foregroundColor = userStyle.foregroundColor;
currentCaptionStyle.foregroundOpacity = userStyle.foregroundColor >>> 24;
currentCaptionStyle.hasWindowColor = userStyle.hasWindowColor();
currentCaptionStyle.windowColor = userStyle.windowColor;
currentCaptionStyle.windowOpcity = userStyle.windowColor >>> 24;
currentCaptionStyle.hasEdgeColor = userStyle.hasEdgeColor();
currentCaptionStyle.edgeColor = userStyle.edgeColor;
currentCaptionStyle.hasEdgeType = userStyle.hasEdgeType();
currentCaptionStyle.edgeType = userStyle.edgeType;
currentCaptionStyle.typeFace = userStyle.getTypeface();
}
});
CaptionStyle
sistemini edinmek için getUserStyle()
numaralı telefonu arayabilirsiniz.
doğrudan:
CaptionStyle systemCaptionStyle = captioningManager.getUserStyle();
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Adopt system caption settings\n\nOn Android TV, settings are provided for users to define their own caption style.\nThis guide demonstrates how an app can obtain and apply the system-provided\ncaption style.\n\nThe caption options can be found under **Settings \\\u003e System \\\u003e Accessibility \\\u003e Caption**:\n\nObtain the CaptioningManager\n----------------------------\n\nFrom an activity, you can get the caption service from its `Context` using\n[`CaptioningManager`](https://developer.android.com/reference/android/view/accessibility/CaptioningManager): \n\n CaptioningManager captioningManager = (CaptioningManager)context.getSystemService(Context.CAPTIONING_SERVICE);\n\nHandle caption style changes\n----------------------------\n\nYou can then handle caption style changes by implementing [`CaptioningChangeListener`](/reference/android/view/accessibility/CaptioningManager.CaptioningChangeListener): \n\n if (captioningManager != null) {\n // Define a class to store the CaptionStyle details.\n CurrentCaptionStyle currentCaptionStyle = new CurrentCaptionStyle;\n // Define the listeners.\n captioningManager.addCaptioningChangeListener(new CaptioningChangeListener() {\n\n @Override\n public void onEnabledChanged(boolean enabled) {\n super.onEnabledChanged(enabled);\n Log.d(TAG, \"onEnabledChanged\");\n currentCaptionStyle.isEnabled = enabled;\n }\n\n @Override\n public void onLocaleChanged(@Nullable Locale locale) {\n super.onLocaleChanged(locale);\n Log.d(TAG, \"onLocaleChanged\");\n currentCaptionStyle.locale = locale;\n }\n\n @Override\n public void onFontScaleChanged(float fontScale) {\n super.onFontScaleChanged(fontScale);\n Log.d(TAG, \"onFontScaleChanged\");\n currentCaptionStyle.fontScale = fontScale;\n }\n\n @Override\n public void onUserStyleChanged(@NonNull CaptionStyle userStyle) {\n super.onUserStyleChanged(userStyle);\n Log.d(TAG, \"onUserStyleChanged\");\n currentCaptionStyle.hasBackgroundColor = userStyle.hasBackgroundColor();\n currentCaptionStyle.backgroundColor = userStyle.backgroundColor;\n currentCaptionStyle.backgroundOpcity = userStyle.backgroundColor \u003e\u003e\u003e 24;\n currentCaptionStyle.hasForegroundColor = userStyle.hasForegroundColor();\n currentCaptionStyle.foregroundColor = userStyle.foregroundColor;\n currentCaptionStyle.foregroundOpacity = userStyle.foregroundColor \u003e\u003e\u003e 24;\n currentCaptionStyle.hasWindowColor = userStyle.hasWindowColor();\n currentCaptionStyle.windowColor = userStyle.windowColor;\n currentCaptionStyle.windowOpcity = userStyle.windowColor \u003e\u003e\u003e 24;\n currentCaptionStyle.hasEdgeColor = userStyle.hasEdgeColor();\n currentCaptionStyle.edgeColor = userStyle.edgeColor;\n currentCaptionStyle.hasEdgeType = userStyle.hasEdgeType();\n currentCaptionStyle.edgeType = userStyle.edgeType;\n currentCaptionStyle.typeFace = userStyle.getTypeface();\n }\n\n });\n\nTo obtain the system `CaptionStyle`, you can call `getUserStyle()`\ndirectly: \n\n CaptionStyle systemCaptionStyle = captioningManager.getUserStyle();"]]