本文整理了Java中android.support.v7.widget.SearchView.setOnSearchClickListener()
方法的一些代码示例,展示了SearchView.setOnSearchClickListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SearchView.setOnSearchClickListener()
方法的具体详情如下:
包路径:android.support.v7.widget.SearchView
类名称:SearchView
方法名:setOnSearchClickListener
暂无
代码示例来源:origin: hidroh/materialistic
@Test
public void testSearchView() {
SearchView searchView = (SearchView) actionViewResolver.getActionView(mock(MenuItem.class));
verify(searchView, atLeastOnce()).setOnSearchClickListener(searchViewClickListener.capture());
verify(searchView, atLeastOnce()).setOnCloseListener(searchViewCloseListener.capture());
searchViewClickListener.getAllValues()
.get(searchViewClickListener.getAllValues().size() - 1)
.onClick(searchView);
assertFalse(((FavoriteFragment) fragment).startActionMode(null));
SearchView.OnCloseListener closeListener = searchViewCloseListener.getAllValues()
.get(searchViewCloseListener.getAllValues().size() - 1);
closeListener.onClose();
assertEquals(2, adapter.getItemCount());
((FavoriteFragment) fragment).filter("ask");
verify(favoriteManager, times(2)).attach(observerCaptor.capture(), any());
when(favoriteManager.getSize()).thenReturn(1);
when(favoriteManager.getItem(eq(0))).thenReturn(new TestFavorite(
"2", "http://example.com", "ask HN", System.currentTimeMillis()));
observerCaptor.getValue().onChanged();
assertEquals(1, adapter.getItemCount());
reset(searchView);
closeListener.onClose();
verify(searchView).setQuery(eq(FavoriteActivity.EMPTY_QUERY), eq(true));
}
代码示例来源:origin: JZ-Darkal/AndroidHttpCapture
searchView.setQueryHint("请输入URL关键字...");
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
代码示例来源:origin: hidroh/materialistic
private void createSearchView(MenuItem menuSearch) {
final SearchView searchView = (SearchView) mActionViewResolver.getActionView(menuSearch);
searchView.setQueryHint(getString(R.string.hint_search_saved_stories));
searchView.setSearchableInfo(((SearchManager) getActivity()
.getSystemService(Context.SEARCH_SERVICE))
.getSearchableInfo(getActivity().getComponentName()));
searchView.setIconified(!mSearchViewExpanded);
searchView.setQuery(mFilter, false);
searchView.setOnSearchClickListener(v -> {
mSearchViewExpanded = true;
v.requestFocus();
});
searchView.setOnCloseListener(() -> {
// trigger a dummy empty search intent, as empty query does not get submitted
searchView.setQuery(FavoriteActivity.EMPTY_QUERY, true);
return false;
});
}
代码示例来源:origin: Delsart/Bookster
MenuItemCompat.getActionView(searchItem);
searchView.setQueryHint("搜索书籍或者作者");
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
代码示例来源:origin: brarcher/budget-watch
searchView.setOnSearchClickListener(new View.OnClickListener()
代码示例来源:origin: nvllsvm/Audinaut
void onFinishSetupOptionsMenu(final Menu menu) {
searchItem = menu.findItem(R.id.menu_global_search);
if (searchItem != null) {
searchView = (SearchView) searchItem.getActionView();
SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
SearchableInfo searchableInfo = searchManager.getSearchableInfo(context.getComponentName());
if (searchableInfo == null) {
Log.w(TAG, "Failed to get SearchableInfo");
} else {
searchView.setSearchableInfo(searchableInfo);
}
String currentQuery = getCurrentQuery();
if (currentQuery != null) {
searchView.setOnSearchClickListener(v -> searchView.setQuery(getCurrentQuery(), false));
}
}
}
代码示例来源:origin: GitLqr/MaterialDesignDemo
mSearchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
代码示例来源:origin: SwiftyWang/FingerColoring-Android
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
代码示例来源:origin: zulip/zulip-android
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
代码示例来源:origin: bigsinger/fakegps
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
代码示例来源:origin: Leaking/WeGit
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
内容来源于网络,如有侵权,请联系作者删除!