安卓.检测何时打开AutoCompleteTextView弹出窗口 [英] Android. Detecting when a AutoCompleteTextView popup is opened

查看:172
本文介绍了安卓.检测何时打开AutoCompleteTextView弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当弹出窗口打开时,我该怎么做?有一个方法isPopupShowing(),但不幸的是没有像onPopupShow()回调的方法.

How I can do something when popup just opens? There is a method isPopupShowing(), but nothing like onPopupShow() callback unfortunately.

推荐答案

我知道来晚了.迟到总比没有好.

I know it's late. Better late than never.

如果仅在用户单击AutoCompleteTextView时显示弹出窗口,我们可以将OnClickListener设置为它,并检查是否显示了弹出窗口.

If popup is only shown when user clicks on AutoCompleteTextView, we can set OnClickListener to it and check if popup is shown.

autoCompleteTextView.setOnClickListener(v -> {
        if (autoCompleteTextView.isPopupShowing()){
            //Do what you want
        }
    });

这篇关于安卓.检测何时打开AutoCompleteTextView弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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