2012-08-15 16 views
8
WindowManager.LayoutParams layout = getWindow().getAttributes(); 
    layout.screenBrightness = 1F; 
    getWindow().setAttributes(layout); 

¡Agregué este código al botón onClick y funcionó! ¿Pero hay un valor más alto ya que la pantalla no se iluminaba MAX?Brillo de pantalla de Android ¿Valor máximo?

Respuesta

4

As stated in the documentation, no. El ajuste screenBrightness en 1 debe ajustar el brillo a la luz total.

+0

Una buena manera de utilizar esto es mediante el uso de la constante 'BRIGHTNESS_OVERRIDE_FULL'. Su valor es 1.0f – Cristan

1

Usted debe ser capaz de establecer el valor como 1 litro y se debe ir al brillo máximo ya que este es el brillo máximo

WindowManager.LayoutParams layout = getWindow().getAttributes(); 
layout.screenBrightness = 1F; 
getWindow().setAttributes(layout); 

a configurarlo con el brillo máximo ..

0

Debe desactivar la pantalla atenuar primero antes de configurar el brillo, o puede obtener un brillo inferior a MAX! Intentar algo como esto antes de configurar el brillo:

// disable screen dimming (note - this also requires setting in manifest file) 
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); 
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen"); 
0

utiliza este código

float SysBackLightValue = 255f; 


android.provider.Settings.System.putInt(BatteryBoosterActivity.this.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS,(int) SysBackLightValue);          
Window myWindow =BatteryBoosterActivity.this. getWindow(); 
WindowManager.LayoutParams winParams = myWindow.getAttributes();         winParams.screenBrightness = 255f; 
myWindow.setAttributes(winParams); 
0

Un ejemplo completo muestra cómo cambiar el brillo mediante la codificación, primer plano, fondo. brightnessdemo

Cuestiones relacionadas