1

我有一项可以提高屏幕亮度的活动

/* turn screen brightness up */ this.getWindow().getAttributes().screenBrightness = 1;

我发现这个内置的 android 功能会使一些手机崩溃。

有没有更通用的方法来提高屏幕亮度?

4

3 回答 3

2

设置属性的正确方法是setAttributes()

WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.screenBrightness = 1;
this.getWindow().setAttributes(lp);
于 2011-07-06T03:22:43.193 回答
0

你可以试试那个差不多的值1。例如:0.999

于 2011-07-05T22:53:42.290 回答
0

如果您希望触摸事件通过,您需要做的不仅仅是设置亮度。您需要设置视图和布局参数。
view.setFocusable(false);
view.setClickable(false);
view.setKeepScreenOn(false);
view.setLongClickable(false);
view.setFocusableInTouchMode(false);

layoutParams.height = LayoutParams.FILL_PARENT;
layoutParams.width = LayoutParams.FILL_PARENT;
layoutParams.flags = 280; // You can try LayoutParams.FLAG_FULLSCREEN too
layoutParams.format = PixelFormat.TRANSLUCENT; // You can try different formats
layoutParams.windowAnimations = android.R.style.Animation_Toast; // You can use only animations that the system to can access
layoutParams.type = LayoutParams.TYPE_SYSTEM_OVERLAY;
layoutParams.gravity = Gravity.BOTTOM;
layoutParams.x = 0;
layoutParams.y = 0;
layoutParams.verticalWeight = 1.0F;
layoutParams.horizontalWeight = 1.0F;
layoutParams.verticalMargin = 0.0F;
layoutParams.horizontalMargin = 0.0F;

看看我原来的帖子

于 2013-04-16T10:20:47.923 回答