اندروید تیوی تنظیماتی را ارائه میدهد که به کاربر اجازه میدهد تنظیمات زیرنویس را به صورت مرکزی تنظیم کند تا یک تجربه منسجم در برنامههای رسانهای ایجاد شود.
این تنظیمات به کاربران اجازه میدهد زیرنویسها را فعال کنند، زبان دلخواه خود را انتخاب کنند و بر اساس نیاز خود، سبک زیرنویس سفارشی را تعریف کنند. کاربران همچنین میتوانند مشخص کنند که آیا زیرنویسهای سادهشده را در سطح خواندن تقریباً کلاس سوم، که به عنوان "خواننده آسان" شناخته میشود، ترجیح میدهند یا خیر.
این راهنما نحوه دریافت و اعمال تنظیمات زیرنویس ارائه شده توسط سیستم را در زیرنویسهای برنامه شما نشان میدهد.
گزینههای زیرنویس، از جمله پیشنمایش سبک زیرنویسهای انتخابشده، را در تنظیمات > دسترسی > زیرنویسها پیدا کنید:

مدیریت زیرنویس را دریافت کنید
از یک activity، سرویس CaptioningManager را از Context دریافت کنید:
CaptioningManager captioningManager = (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
مدیریت تغییرات تنظیمات زیرنویس
با پیادهسازی کلاس CaptioningChangeListener تغییرات تنظیمات عنوان را مدیریت کنید:
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;
if (locale == null) {
currentCaptionStyle.isEasyReaderEnabled = false;
} else {
currentCaptionStyle.isEasyReaderEnabled = locale.getVariant().contains("simple");
}
}
@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.backgroundOpacity = 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.windowOpacity = userStyle.windowColor >>> 24;
currentCaptionStyle.hasEdgeColor = userStyle.hasEdgeColor();
currentCaptionStyle.edgeColor = userStyle.edgeColor;
currentCaptionStyle.hasEdgeType = userStyle.hasEdgeType();
currentCaptionStyle.edgeType = userStyle.edgeType;
currentCaptionStyle.typeFace = userStyle.getTypeface();
}
});
}
روش دیگر، فراخوانی مستقیم متد getUserStyle است:
CaptionStyle systemCaptionStyle = captioningManager.getUserStyle();