使用带有动画的AttributeFlagsBitmap = AttributeFlagsBitmap |
(UInt32)PlayerAttributes.EAttributesFlagsBmp.AIn &
~(UInt32)PlayerAttributes.EAttributesFlagsBmp.BIn;
+ RecyclerView
适配器时,如何实现搜索过滤器。
RealmRecyclerViewAdapter
答案 0 :(得分:0)
您不需要Filterable。这对我来说很好。我保留了方法" applyFilter"在适配器下,但随时随地保持它。只要搜索文本发生更改,您就需要调用此方法。 " applyFilter"方法调用"更新"在适配器上。
searchText.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) {
groupAdapter.applyFilter(s.toString());
}
@Override
public void afterTextChanged(Editable s) {}
});
public void applyFilter(String searchString) {
if (searchString == null || "".equals(searchString)) {
realmResults = realm.where(Group.class).findAllSorted("groupName");
} else {
realmResults = realm.where(Group.class).contains("groupName", searchString.toString().trim()).findAllSorted("groupName");
}
updateData(realmResults);
}