2012-11-02 54 views
1

我想用我的应用程序来改变系统亮度。但是,一旦我出来的应用程序。亮度再次重置为默认值。为了永久改变亮度设置,我做了些什么?我尝试了几种方法,但是只有我的应用程序未关闭才能工作。如何更改系统亮度?

+0

重复【如何改变屏幕亮度(http://stackoverflow.com/questions/12487004/how-to-change-screen-亮度?rq = 1) –

+0

是的,但我不能找到一个合适的解决方案.. –

+0

见下文。让我知道它是否有效。 [改变屏幕亮度](http://www.tutorialforandroid.com/2009/01/changing-screen-brightness.html) – prageeth

回答

0

此代码是为了改变android deveice的亮丽而努力工作。

Settings.System.putInt(this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 20); 

    WindowManager.LayoutParams lp = getWindow().getAttributes(); 
    lp.screenBrightness =0.2f;// 100/100.0f; 
    getWindow().setAttributes(lp); 

    startActivity(new Intent(this,RefreshScreen.class)); 

也给下面的权限清单文件的

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>