Pregunta

Quiero un diálogo que ajuste el brillo de la pantalla usando SeekBar.

Cómo mostrar el cuadro de diálogo personalizado con SeekBar que ajusta el brillo de la pantalla?

¿Fue útil?

Solución

Puedes usar esta API. Esto cambiará el brillo de la pantalla de su ventana y no de todo el sistema.

        // Make the screen full bright for this activity.
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.screenBrightness = 1.0f;

        getWindow().setAttributes(lp);

Otros consejos

Este fragmento de código debería ayudarte

pdlg = ProgressDialog.show(getParent(), "Loading...", ""); 
WindowManager.LayoutParams lp = pdlg.getWindow().getAttributes();
p.dimAmount=0.0f;        //Dim Amount
pdlg.getWindow().setAttributes(lp);  //Applying properties to progress dialog
pdlg.dismiss(); //Dismiss the dialog

Oye, puedes establecer el brillo del sistema así:

 //Set the system brightness using the brightness variable value
System.putInt(cResolver, System.SCREEN_BRIGHTNESS, brightness);
//Get the current window attributes
LayoutParams layoutpars = window.getAttributes();
//Set the brightness of this window
layoutpars.screenBrightness = brightness / (float)255;
//Apply attribute changes to this window
window.setAttributes(layoutpars);

O puede referirse en este completo tutorial

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top