大佬教程收集整理的这篇文章主要介绍了Android 2.2:调整屏幕亮度,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
public void SetBright(float value) { Window mywindow = getWindow(); WindowManager.LayoutParams lp = mywindow.getAttributes(); lp.screenBrightness = value; mywindow.setAttributes(lp); }
就像是:
int brightnessMode = SetTings.System.geTint(getContentResolver(),SetTings.System.SCREEN_BRIGHTnesS_MODE); if (brightnessMode == SetTings.System.SCREEN_BRIGHTnesS_MODE_AUTOMATIC) { SetTings.System.puTint(getContentResolver(),SetTings.System.SCREEN_BRIGHTnesS_MODE,SetTings.System.SCREEN_BRIGHTnesS_MODE_MANUAL); } WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.screenBrightness = 0.5F; // set 50% brightness getWindow().setAttributes(layoutParams);
确保该值介于0.0F和1.0F之间.值-1.0F使用首选项中存储的默认亮度.根据文档“值小于0,默认值,意味着使用首选屏幕亮度.0到1调整亮度从暗到亮.”
以上是大佬教程为你收集整理的Android 2.2:调整屏幕亮度全部内容,希望文章能够帮你解决Android 2.2:调整屏幕亮度所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。