In one of my activities, I want my UI to be dimmed at all times. When the used presses a navigation button (back, home, recent apps) it should act like normal, but when focus is back to my activity, it should go back to lights-out. Currently, I have lights-out working, but after I press Recent Apps, the lights stay on forever.
How do I make my app always stay in lights-out?
Figured out something that worked.
@Override
public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
lightsOut();
}
}
}
Basically, every time my app gets focus, it forces lights out (possibly redundantly, but it doesn't really matter).
Works like a charm!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.