有人知道如何在Mono for Android中以编程方式调整屏幕亮度。
答案 0 :(得分:1)
这是一个非常古老的帖子,但由于没有回答,我遇到了同样的问题,我做的是下一个:
WindowManagerLayoutParams windowManagerLayoutParams = new WindowManagerLayoutParams();
windowManagerLayoutParams.CopyFrom(Window.Attributes);
windowManagerLayoutParams.ScreenBrightness = 1f; //set screen to full brightness
Window.Attributes = windowManagerLayoutParams;
将其设置回自动:
WindowManagerLayoutParams windowManagerLayoutParams = new WindowManagerLayoutParams();
windowManagerLayoutParams.CopyFrom(Window.Attributes);
windowManagerLayoutParams.ScreenBrightness = -1;
Window.Attributes = windowManagerLayoutParams;
如果您想保存旧亮度并将其恢复原状,可以将其存储在变量中并再次使用。