PopupWindow其中的view获取焦点?

来源:互联网 发布:招商银行mac控件下载 编辑:程序博客网 时间:2024/05/21 10:36

需要3:

setFocusable(true);setBackgroundDrawable(new BitmapDrawable());随便设置背景,可以设置为空,但必须设置。setOutsideTouchable(true);这里是设置点击外部dismiss,也就是消失。

如果里面有强制获取焦点的控件,如Button,ImageButton,Checkbox等。
解决方法:在其根布局增加以下属性

  android:descendantFocusability="blocksDescendants"

设置之后,Button获取焦点,item中其他控件也可以获取焦点。

0 0
原创粉丝点击