在android自定义列表视图中实现搜索小部件界面

时间:2013-06-24 11:14:40

标签: android android-layout android-listview

您好我想在我的Android应用中添加一个搜索小部件,例如Whatsapp,用户点击搜索按钮并显示用户结果... 我已经在我的自定义列表视图中实现了搜索逻辑,现在我想要分离我的搜索逻辑和Listview逻辑...我缺少的是没有找到用户的时候显示一个屏幕说没有用户并且还在ActionBar中实现了搜索按钮

以下是我的搜索逻辑代码......

EditText editTxt = (EditText) findViewById(R.id.inputSearch);          

// <To Implement No results Found>

editTxt.addTextChangedListener(new TextWatcher() {

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

            if (count < before) {
                // We're deleting char so we need to reset the adapter data
                bindingData.resetData();
            }

            bindingData.getFilter().filter(s.toString());

        }

        /*Auto Generated Methods */
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {

        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });

0 个答案:

没有答案
相关问题