我使用的ListPopupWindow,我觉得非常适合这个目的,但有一个例外。 我希望能够检测用户何时从列表中选择一个项目或按下后退按钮。 目前发生的情况是,当在ListPopupWindow列表之外单击某个项目时,我无法确定所点击的内容,并且ListPopupWindow被解散。 理想情况下,我希望用户只能从列表中选择一个项目或按下后退按钮,但是我无法实现这一点。 我搜索了一个答案并进行了数小时的实验,但是我无法达到要求。 据我所知,将模态设置为true或false似乎没有区别。 我显然可以检测到从列表中选择了什么,但是无论用户是按下后退按钮还是单击列表外部,似乎都会关闭ListPopupWindow,并且我无法确定导致它的操作,除非未选择项目。 如何检测或防止用户从列表中选择项目或按下后退按钮?
I'm using ListPopupWindow which I find very suitable for the purpose with one exception. I want to be able to detect when the user does other than select an item from the list or presses the back button. Currently what is happening is that when an item is clicked outside of the ListPopupWindow list I cannot determine what was clicked and the ListPopupWindow is dismissed. Ideally what I would prefer is for the user to only be able to select an item from the list or press the back button, however I cannot achieve that. I've searched for an answer and experimented for hours but I cannot achieve what is required. As far as I can determine, setting modal to either true or false appears to make no difference. I can obviously detect what is selected from the list, however whether the user presses the back button or clicks outside of the list appear to both dismiss the ListPopupWindow and I cannot determine the action that caused it other than an item was not selected. How can I either detect or prevent other than the user selecting an item from the list or pressing the back button?
最满意答案
据我可以确定,这可以使用解决
android.support.v7.widget.ListPopupWindow;和
setForceIgnoreOutsideTouch(true)As far as I can determine, this can be solved using
android.support.v7.widget.ListPopupWindow;and
setForceIgnoreOutsideTouch(true)更多推荐
发布评论