What is the difference between hasFocus () and isFocused () in android?

I understand the difference between focused, selected and pressed . But I do not understand the difference between hasFocus() and isFocused() . I checked the description, both descriptions say almost the same thing. Can anyone explain this to me?

+6
source share
2 answers

hasFocus() is different from isFocused() . hasFocus() == true means that the View or one of its descendants is focused. If you take a closer look, there is a chain of hasFocused Views until you reach the view that IsFocused.

+11
source

That should explain a little about it.

Sometimes views in Android are grouped together, and if one of the views in this group has focus, the hasFocus() method returns true , but only if the particular view that you mention in the code is focused, isFocused() is true .

+3
source

All Articles