【问题标题】:How to restrict ExposedDropdownMenu to enter text in AutocompleteTextViw如何限制 ExposedDropdownMenu 在 AutocompleteTextViw 中输入文本
【发布时间】:2020-08-23 04:22:00
【问题描述】:

我在不想在其中输入文本的应用程序中使用 ExposedDropdownMenu。它应该只从下拉列表中选择项目。它在正常情况下工作正常,但如果我点击其他 EditText 并快速点击 ExposedDropdownMenu 并输入文本,文本会反映在 ExposedDropdownMenu 中。如何解决此问题

【问题讨论】:

  • 这有点难以理解,但也许这是一个应该报告给库的错误跟踪器的错误?

标签: android material-ui material-design


【解决方案1】:

我通过在其中添加 TouchListener 和 showDropDown() 解决了这个问题。

 binding.etType.setOnTouchListener(new View.OnTouchListener() {
       @Override
       public boolean onTouch(View v, MotionEvent event) {

           binding.etType.showDropDown();
            return false;
       }
    });

【讨论】:

    猜你喜欢
    • 2015-01-31
    • 1970-01-01
    • 2010-11-09
    • 1970-01-01
    • 2015-05-20
    • 2017-03-09
    • 1970-01-01
    • 2016-03-26
    相关资源
    最近更新 更多