I've got a LinearLayout with a bunch of buttons on it. This panel is always hidden unless a menu item is chosen.
When the LinearLayout is shown, I want to detect if the user clicks anywhere outside of the panel so that I can hide it again. Is there a way to do this, maybe with detecting focus changes?
I've tried to add an OnFocusChangeListener to the LinearLayout itself (and called setFocusable(true) on it), but the focus change listener never gets called. Furthermore, I'd have to be able to detect if the LinearLayout or any of its children lose focus.