Refreshing the display from a widget?

前端 未结 2 1812
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-11 19:28

I am trying to set the screen brightness from a widget. We know this is easily possible since tons of widgets do this already, but how.....

In a service I call from

相关标签:
2条回答
  • 2021-01-11 19:41

    Shameless copy&paste from Changing the Screen Brightness System Setting Android

    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    

    does it all.

    0 讨论(0)
  • 2021-01-11 19:45

    For the blackscreen, set a theme on the activity, containing this:

    <style name="Theme.Transparent" parent="android:Theme"> 
    <item name="android:windowIsTranslucent">true</item> 
    <item name="android:windowBackground">@color/transparent</item> 
    <item name="android:windowContentOverlay">@null</item> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:windowIsFloating">true</item> 
    <item name="android:backgroundDimEnabled">false</item> 
    </style>
    

    Thanks Sebastian for the answer, I've copied it in here.

    0 讨论(0)
提交回复
热议问题