0
int BrightnesValue= 0;
        try {
            BrightnesValue = Settings.System.getInt(
                    getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
        } catch (Settings.SettingNotFoundException e) {
            e.printStackTrace();
        }
        int SysBackLightValue = BrightnesValue-25;
        android.provider.Settings.System.putInt(getContentResolver(),
                android.provider.Settings.System.SCREEN_BRIGHTNESS,
                SysBackLightValue);

こちらの画像に示すように、ツールバーのボタンを使用してシステムの明るさをプログラムで変更したいと考えています。最初にクリックすると明るさが減少し、2 回目にクリックすると明るさがデフォルトに戻ります。

4

1 に答える 1