Domanda

Voglio una finestra di dialogo che regola la luminosità dello schermo utilizzando SeekBar.

Come visualizzare il dialogo personalizzato con SeekBar che regola la luminosità dello schermo?

È stato utile?

Soluzione

Puoi usare questa API. Questo cambierà la luminosità dello schermo della tua finestra e non di tutto il sistema.

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

        getWindow().setAttributes(lp);

Altri suggerimenti

Questo frammento di codice Dovresti aiutarti

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

Hey puoi impostare la luminosità del sistema in questo modo:

 //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);

Oppure puoi fare riferimento a questo completo Tutorial

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top