两个视图都可以集中在Android上吗 [英] Can two views both have focus in Android

查看:89
本文介绍了两个视图都可以集中在Android上吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个EditText和一个popupWindown(其中有一个ListView),现在我触摸EditText,显示popupWindow.

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

我需要这样的情况:我可以在SoftInput中输入某些内容,也可以单击ListView中的子项,它是PopupWindow的子项.

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.

现在,我只能输入,或者只能单击listview,但我不能在Android 4.1、4.2中同时执行这两项操作.但是我可以在Android 4.4、5.0中做到这两者.

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。

我以多种方式尝试过,例如popupWindo.setFocus(true),它只会使EditText失去焦点.

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

那么,Android是否可以允许两个视图都具有焦点?

So, Can android allow two views both have focus ?

推荐答案

不,两个(或多个)视图不能同时具有焦点,这是不可能的.

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

此处 是如何将焦点从一个textView更改为另一个textView.您可以根据自己的情况进行更改.

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

这篇关于两个视图都可以集中在Android上吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆