/** * Changes the density for this display. * * Any registered {@link android.hardware.display.DisplayManager.DisplayListener}s will be * notified of the change. */ public void setDensity(float density) { setDensityDpi((int) (density * DisplayMetrics.DENSITY_DEFAULT)); }
@Test public void shouldProvideDisplayMetrics() throws Exception { shadow.setDensity(1.5f); shadow.setDensityDpi(DisplayMetrics.DENSITY_HIGH); shadow.setScaledDensity(1.6f); shadow.setWidth(1024);
/** * Changes the density for this display. * * Any registered {@link android.hardware.display.DisplayManager.DisplayListener}s will be * notified of the change. */ public void setDensity(float density) { setDensityDpi((int) (density * DisplayMetrics.DENSITY_DEFAULT)); }