本文整理汇总了Java中android.widget.SearchView.OnCloseListener类的典型用法代码示例。如果您正苦于以下问题:Java OnCloseListener类的具体用法?Java OnCloseListener怎么用?Java OnCloseListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnCloseListener类属于android.widget.SearchView包,在下文中一共展示了OnCloseListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newOnCloseListener
import android.widget.SearchView.OnCloseListener; //导入依赖的package包/类
public static Object newOnCloseListener(final OnCloseListenerCompatBridge listener) {
return new OnCloseListener() {
public boolean onClose() {
return listener.onClose();
}
};
}
示例2: newOnCloseListener
import android.widget.SearchView.OnCloseListener; //导入依赖的package包/类
public static Object newOnCloseListener(final OnCloseListenerCompatBridge listener) {
return new OnCloseListener() {
@Override
public boolean onClose() {
return listener.onClose();
}
};
}
示例3: makeSearchMenuEntry
import android.widget.SearchView.OnCloseListener; //导入依赖的package包/类
@Override
public MenuItem makeSearchMenuEntry(Menu menu) {
MenuItem item = menu.add("Search");
searchView = new SearchView(diskusage);
origSearchBackground = searchView.getBackground();
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
item.setIcon(android.R.drawable.ic_search_category_default);
item.setActionView(searchView);
if (searchPattern != null) {
searchView.setIconified(false);
searchView.setQuery(searchPattern, false);
}
searchView.setOnCloseListener(new OnCloseListener() {
@Override
public boolean onClose() {
Log.d("diskusage", "search closed");
searchPattern = null;
diskusage.applyPatternNewRoot(masterRoot, null);
return false;
}
});
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
onQueryTextChange(query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
Log.d("diskusage", "search query changed to: " + newText);
searchPattern = newText;
applyPattern(searchPattern);
return true;
}
});
return item;
}
示例4: setOnCloseListener
import android.widget.SearchView.OnCloseListener; //导入依赖的package包/类
public static void setOnCloseListener(Object searchView, Object listener) {
((SearchView) searchView).setOnCloseListener((OnCloseListener) listener);
}