Which resource qualifier should I use to support 1080p, 720p android TV? - Android

前端 未结 2 1115
再見小時候
再見小時候 2020-12-10 06:13

In order to define different dimension values for 1080p and 720p android TV, I need to decide which qualifier I should use. When I\'m trying to use something like values-sw1

2条回答
  •  自闭症患者
    2020-12-10 07:03

    There are three screen densities that can be considered for Android TV, and three corresponding qualifiers. These include:

    1. tvdpi - (213dpi) - intended for 720p televisions;
    2. xhdpi - (320dpi) - intended for 1080p (HD) televisions;
    3. xxxhdpi - (640dpi) - intended for 4k (Ultra HD) televisions.

    But according to https://developer.android.com/training/tv/start/layouts.html#density-resources:

    Your TV layout should target a screen size of 1920 x 1080 pixels [standard 1080p/HD], and then allow the Android system to downscale your layout elements to 720p if necessary.

    This implies that, if you follow this advice and always design to a 1080p specs, you could use the -television UI Mode Qualifier and be done with it.

    If you need to deliver different images and layouts for the different TV sizes, though, you can use the screen density qualifiers above.

    The “standard” images and layouts for TV could be stored in a -xhdpi folder, as xhdpi is the qualifier used for 1080p TVs.

    If (optional) high-resolution versions of images are desired for 4k TVs, they can be supplied as “2x” images, and stored in a drawable-xxxhdpi folder. Similarly, dimensions/layouts intended to only target 4k TVs could be placed in -xxxhdpi.

    (Note in particular that the -tvdpi qualifier is specific to 720p, and is almost certainly not what you want to use to support modern TVs.)

    The documentation is sparse and slightly contradictory, but I base this primarily on these sources:

    https://developer.android.com/guide/practices/screens_support.html https://stackoverflow.com/a/11581786/925478

提交回复
热议问题