需要3:
setFocusable(true);
setBackgroundDrawable(new BitmapDrawable());随便设置背景,可以设置为空,但必须设置。
setOutsideTouchable(true);这里是设置点击外部dismiss,也就是消失。
如果里面有强制获取焦点的控件,如Button,ImageButton,Checkbox等。
解决方法:在其根布局增加以下属性
android:descendantFocusability="blocksDescendants"
设置之后,Button获取焦点,item中其他控件也可以获取焦点。