gpt4 book ai didi

android - 使用 EditText 在 ListView 中搜索

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:00:46 25 4
gpt4 key购买 nike

我有一个 ListView。它的每一行包含 3 个 TextView 和 2 个 Button。在它上面我有一个 EditText。如何根据每行第一个 TextView 中的值过滤我的 ListView

最佳答案

为 ListView 创建一些数组列表..并且在“AddTextChangeListener”上您可以在列表中搜索类似的项目并为搜索到的文本加载一个新的数组列表...

edittext.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable s) {
//search for the keyword and add the items to a new arraylist
}

关于android - 使用 EditText 在 ListView 中搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10816243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com