简体   繁体   English

如何在Android中将手机置于暗淡模式?

[英]How to put my phone in dim mode in Android?

I want to put my phone in dim mode using my application. 我想使用我的应用程序将手机置于暗淡模式。 It seems phone's home screen will be in deem mode. 似乎手机的主屏幕将处于deem模式。 If I going to use Power Manager class then it will drain battery. 如果我要使用电源管理器类,则它将耗尽电池电量。 How can I do this then? 那我该怎么做呢? Can any one give some sample code? 任何人都可以提供一些示例代码吗?

In my case I just update the Android Default Settings, 就我而言,我只是更新了Android默认设置,

android.provider.Settings.System.putInt(cr,android.provider.Settings.System.SCREEN_BRIGHTNESS, 1);

Note: here 1 is value for dim (low) (values 0 t0 250) , and cr is ContentResolver's object 注意:这里1是dim(low)的值(值0 t0 250),而cr是ContentResolver的对象

For this you have to mentioned permission in manifest file, 为此,您必须在清单文件中提及权限,

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android中以编程方式将手机置于飞行模式? - How to put a phone in Airplane mode programmatically in Android? 如何在 Android M 上将我的应用程序置于待机模式 - How do I put my app in Standby mode on Android M 如何获取Android手机的当前位置模式? - How to get the current Location mode of an android phone? 如何将更新的电话号码放入为Android应用程序选择的字段? - How can I put the updated phone number into the field I picked for my Android app? 如何将我在 Android Studio 中制作的应用程序放入手机中? - How do I put an app I did in Android Studio in my phone? 如果我的手机处于浅色或深色模式,如何制作带有文本和背景颜色的 Android 启动画面? - How can I make an Android splash screen with text & background color that changes if my phone is in light or dark mode? 如何在没有底座的情况下将android置于汽车模式? - How to put android to a car mode without a dock? 如何在android中将屏幕置于睡眠模式? - How to put the screen in sleep mode in android? Android:即使手机处于纵向模式,如何在横向模式下显示片段? - Android: How to display fragment in landscape mode, even if the phone is in portrait mode? Eclipse或Android Studio无法在USB调试模式下识别我的手机 - eclipse or android studio not recognize my phone on usb debugging mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM