First publish my test results, Android inside in addition to edittext to it after binding Onfocuschangelistener, will return true, the other components are not responding, unless you call Requestfocus, But even if you call the Requestfocus after, Onfocuschangelistener will still give you return false, many online posts on the focus of the problem are specious, so I decided to find the answer from the source code, Looking for a long day only from the TextView found some clues:
@Override Public Event ) { intevent. getactionmasked (); if null) Meditor.ontouchevent (event);
And the Meditor statement is here:
Private Editor Meditor;
And this editor class in the end is what thing, the source of clues is interrupted, but at least a point, EditText (EditText than the general TextView one editor) of the processing logic with the general TextView is not the same, And it's probably written about the logic that changed focus.
Also tested two occasions, one is a page only a edittext, to it binding Onfocuschangelistener, click on the other areas of the page, Focuslistener is not any reaction; the second occasion, Multiple edittext in turn, Onfocuschangelistener magically played a role.
Finally, I found a reasonable answer in a foreign forum:
In fact, think carefully, before writing selector time android:state_hovered This property set up is also not work, later found out that the foreigner's argument is aimed at the mouse, and then himself does not superstitious, to the plate inserted mouse, it is really working, This focus is the same reason, but based on the particularity of EditText (EditText is the cursor), Android gave EditText special case, although the source is not found, but we can guess: meditor.ontouchevent ( Event) is the logic to change focus.
The last classmate's point of view I very much agree with, have to echo a sentence: This nappy guy comment was just proof to me that the Android API was complete garbage!
Why Android your onfocuschangelistener and android:state_hovered don't work