WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
このコードをボタンonClickに追加しましたが、機能しました。しかし、画面がMAXを点灯しなかったので、より高い値はありますか?
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
このコードをボタンonClickに追加しましたが、機能しました。しかし、画面がMAXを点灯しなかったので、より高い値はありますか?
ドキュメントに記載されているように、いいえ。1に設定screenBrightness
すると、明るさがフルライトに調整されます。
値を1Lに設定でき、これが最大輝度であるため、最大輝度になるはずです。
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
最大輝度に設定します。
明るさを設定する前に、まず画面の調光を無効にする必要があります。そうしないと、最大輝度よりも低くなる可能性があります。明るさを設定する前に、次のようなことを試してください。
// 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");
このコードを使用します
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);
完全な例は、コーディング、前景、背景によって明るさを変更する方法を示しています。 明るさデモ