Search code examples
androidandroid-layoutandroid-5.0-lollipopandroid-tv

Overscan margin on Android TV


I'm modifying the existing application to work on Android TV with a ADT-1 Developer Kit.
The outside edge of the original application layout when installing on Android TV is clipped.
Then I followed this link and set the overscan for the root of the layout.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/base_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:layout_marginTop="27dp"
  android:layout_marginLeft="48dp"
  android:layout_marginRight="48dp"
  android:layout_marginBottom="27dp" >
  .....
</LinearLayout>

But the result is like below. The root of layout is margin so much, it doesn't fill the screen (the area in red rectangle).
What is the pixel of overscan margin for the root layout to fill exactly the screen? Thanks in advance. enter image description here


Solution

  • There is no correct margin, because it depends on your TV.

    Some TVs will enlarge the picture (say, those with a non-so-standard aspect ratio) so that it will fit the screen, some others will leave the picture as is.

    You are hence adding a 10% margin to your layout, to make sure it will always be visible. Using px instead of dp will make little to no difference.