通过Android应用搜索Android

2023-09-05 05:22:27 作者:现在10后们慢慢登上了网络的舞台,本期QQ乐园小编为10后们

我试图创建Android应用程序,其中包含名单,我想用搜索栏在里面进行搜索,并在应用程序的功能还搜索。换句话说,我创建的应用程序,它显示在列表和用户的课程可以通过输入名字像谷歌搜索栏,并寻找可以在应用程序的功能,搜索特定的课程。 是有任何来源$ C ​​$ C这个?

I'm trying to create android app that contains lists where I want to search in it using the search bar and also search in the app features. In other words, I'm creating app that shows IT courses in a list and user can search for a specific course by typing the name in the search bar like google and also the search can be for the features in the app. is there are any source code for this?

在此先感谢。

推荐答案

您想实现的ListView搜索功能...

Are you trying to implement search functionality in listView...

您可以创建的EditText上面ListView和实施TextChangeListener ...

you can create EditText above ListView and implement TextChangeListener...

在这里,根据的EditText的输入字符串可以过滤列表视图。

In here, as per the input string of EditText you can filter the listView.

inputSearch.addTextChangedListener(new TextWatcher() {

    @Override
    public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
        // When user changed the Text
        MainActivity.this.adapter.getFilter().filter(cs);  
    }

    @Override
    public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
            int arg3) {
        // TODO Auto-generated method stub

    }

    @Override
    public void afterTextChanged(Editable arg0) {
        // TODO Auto-generated method stub                         
    }
});

尝试此链接 ..

这将引导您正确的方向。

This will guide you in proper direction..

让我知道如果你想要别的东西。

Let me know if you want something else..

 
精彩推荐
图片推荐