Manage focus in user view

I implement a custom one View, and I want to control the focus so that when it is in a focused state, it will be created in a different way than in a normal state. I know that I will probably have to override onFocusChanged, but how do I get this method when the view should lose focus, for example, when there is a tap outside? I searched in the docs but no luck.

+4
source share
1 answer

The onFOcusChanged method is called every time the focus of your view changes, so if the user touches your view, you will receive a call to onFocusChanged.

, .

protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {}
0

All Articles