Search code examples
androidandroid-edittextandroid-popupwindow

Can two views both have focus in Android


I have a EditText, and a popupWindown(which has a ListView in it), now i touch the EditText, the popupWindow shows.

i need the situation: i can input something in SoftInput, and i also can click a child item in ListView which is the children of PopupWindow.

Now, i can only input, or can only click listview , i can't do the both thing in Android 4.1, 4.2. But i can do both in Android 4.4, 5.0。

I tried in many ways, like popupWindo.setFocus(true), which only make the EditText lose the focus.

So, Can android allow two views both have focus ?


Solution

  • No, two (or more) views cannot have focus at the same time, not possible.

    Here is how to change focus from one textView to another textView. Which you could change in your case.