Question

What I'm thinking of doing in one of my projects is whenever the user gets a wrong answer I want to tint the screen red for a quick second (kind of like getting hurt in most video games) but then dissipate.

I was thinking of creating a transparent activity that has a red background and have that pop up for a second then disappear, but the problem with that is the user wouldn't be able to click anything while the transparent activity is active (if that makes any sense).

I guess I'm looking for possibly a simpler solution or if android has any options in this area?

Était-ce utile?

La solution

I'd pop up a full screen view with a red transparent background on top of your view. It can be in your layout xml file, just change its visibility from GONE to VISIBLE for a few seconds.

If you want the app to remain responsive, you'll need to override onTouchEvent for that view to return false, so the touch events will be passed on to the view behind it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top