1

I have an activity that boosts screen brightness

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

I found out this built in android function crashes some phones.

Is there a more universal way to boost screen brightness?

4

3 に答える 3

2

The correct way to set attributes is with setAttributes():

WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.screenBrightness = 1;
this.getWindow().setAttributes(lp);
于 2011-07-06T03:22:43.193 に答える
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 に答える