Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the search text popup when filtering a ListView?

When using a filtered ListView, how do I disable the popup that shows the filter text above the ListView? It's obscuring the ListView and I'd like to prevent it from showing, but so far I haven't been able to find a suitable workaround.

like image 900
Steven Peterson Avatar asked Jan 01 '26 12:01

Steven Peterson


1 Answers

I'm not sure if you can do this on the standard ListView, you may have to extend it. Alternatively, if you have your own EditText on screen (I can't tell for sure, but the picture you posted looks like there is one), you can do something like this:

EditText et = (EditText) findViewById(R.id.edit_text_id_goes_here);
et.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {}

        @Override
        public void afterTextChanged(Editable s) {
            adapter.getFilter().filter(s);
        }
});
like image 138
Karakuri Avatar answered Jan 03 '26 10:01

Karakuri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!