Search code examples
javaandroideventsdrop-down-menuautocompletetextview

How to capture the AutoCompleteTextView arrow click event


Arrow

How do I capture the click on the AutoCompleteTextView arrow.

OnClick works for the rest of the component, but it doesn't work when you specifically click the arrow.


Solution

  • It took a while, but I found the solution.

    The event is in the parent of the AutoCompleteTextView.

    XML:

    XML

    Solution:

    public com.google.android.material.textfield.TextInputLayout txtGleba;
    

    ...

    txtGleba = findViewById(R.id.txtGleba);
        txtGleba.setEndIconOnClickListener  (new View.OnClickListener() {
            @Override
            public void onClick(View v) {
    
    
            }
        });