Free AI web copilot to create summaries, insights and extended knowledge, download it at here
2216
Abstract
#setVideoChangeFrameRateStrategy(int)"><code>ExoPlayer.setVideoChangeFrameRateStrateg</code>y()</a> before implementing the approach above.</p><h2 id="ef74">Switching with application focus</h2><p id="a67a">If all your video content is the same frame rate (e.g. 50Hz), it may be more sensible to allow panels that cannot switch seamlessly to perform their refresh rate switch when your application starts. In this case, you may instead choose to enumerate all supported display modes through <a href="https://developer.android.com/reference/android/view/Display#getSupportedModes()"><code>Display.getSupportedMode</code>s()</a> to find a mode that best suits your needs, and specify it as the <code>preferredDisplayModeId</code> in the WindowManager’s attributes. For example:</p>
<figure id="afe7">
<div>
<div>
<iframe class="gist-iframe" src="/gist/pflammertsma/671f571c5a763b0e4916ad1e9cefa82e.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><h1 id="db42">Text scaling</h1><p id="59c7"><b>A new accessibility options screen in Android 12 allows users to adjust the size of text on the screen, so it’s now even more important to <a href="https://developer.android.com/training/tv/accessibility#text_scaling">support text scaling</a>.</b> Specifying text sizes in scalable pixels is essential, but also take special care to ensure that layouts rearrange components as their dimensions change and that everything still fits on the screen when the text scale is increased or decreased.</p><figure id="3d11"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*xe0QYe-LQJWm-DNk"><figcaption></figcaption></figure><p id="bf68">Text scale has always been an accessibility setting in Android and with Android 12, we are introducing a settings screen in Android TV so users can adjust it to their preference. You don’t have to wait to get ahold of Android 12 to find this new settings screen; it can be adjusted through ADB:</p><div id="b6e4"><pre>adb <span class="hljs-built_in">shell</span> settings <span class="hljs-built_i
Options
n">put</span> <span class="hljs-keyword">system</span> font_scale <span class="hljs-number">1.2</span>f</pre></div><p id="ffdf">It’s generally recommended to use dynamic layouts with components that use <code>wrap_content</code> for dimensions and allow the user to scroll to access content that doesn’t fit in the screen. You can always query the value of <code>FONT_SCALE</code> from <code>resources.configuration.fontScale</code>.</p><h1 id="ca1c">4K UI support</h1><p id="5895">Android itself will begin rendering UIs natively at 4K on supported devices. Much like the migration from 720p to 1080p, TV apps should not make assumptions about the dimensions of the screen. Avoid hardcoding pixel values by designing responsive UIs and <a href="https://developer.android.com/training/multiscreen/screensizes">supporting different screen sizes</a>.</p><p id="3323">Read more about <a href="https://developer.android.com/training/tv/start/layouts.html#density-resources">managing layout resources in our recommendations for building TV layouts</a>.</p><h1 id="9962">Android 12 developer preview for Android TV</h1><figure id="c7a1"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*Q5BWwrZpYXlg48yO.jpeg"><figcaption>The Android 12 developer preview is available for the ADT-3.</figcaption></figure><p id="0f48">Android 12 is available as a developer preview on the<a href="https://store.askey.com/adt-3.html"> ADT-3 developer kit</a>; the Android 12 developer preview for TV will be installed automatically through an OTA, or you can install the latest image manually.</p><p id="eb18">Alternatively, you can use the <a href="https://developer.android.com/training/tv/start/start#run-on-a-virtual-device">Android Emulator for TV</a> which allows you to try out these and other new user interface capabilities like <a href="https://source.android.com/devices/tech/display/window-blurs">window blurs</a>.</p><p id="6967">Android 12 will begin appearing on TVs later this year, so now is the time to begin evaluating your app for compatibility.</p><p id="6061"><i>Editor’s note: a previous version of this story stated that Android 12 would begin appearing on TVs early this year.</i></p></article></body>