Google 致力于为黑人社区推动种族平等。查看具体举措

DisplayCompat

public final class DisplayCompat
extends Object

java.lang.Object
   ↳ androidx.core.view.DisplayCompat


A class for retrieving the physical display size from a device. This is necessary because Display.Mode.getPhysicalDisplaySize might not report the real physical display size because most ATV devices don't report all available modes correctly. In this case there is no way to find out whether a device is capable to display 4k content. This class offers a workaround for this problem.

Summary

Nested classes

class DisplayCompat.ModeCompat

Compat class which provides an additional isNative() field. 

Public methods

static ModeCompat[] getSupportedModes(Context context, Display display)

Gets the supported modes of the given display where at least one of the modes is flagged as isNative().

Inherited methods

Public methods

getSupportedModes

public static ModeCompat[] getSupportedModes (Context context, 
                Display display)

Gets the supported modes of the given display where at least one of the modes is flagged as isNative(). Note that a native mode might not wrap any Display.Mode object in case the display returns no mode with the physical display size.

Parameters
context Context

display Display

Returns
ModeCompat[] an array of supported modes where at least one of the modes is native which contains the physical display size