本文整理了Java中android.widget.SearchView.setSubmitButtonEnabled()
方法的一些代码示例,展示了SearchView.setSubmitButtonEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SearchView.setSubmitButtonEnabled()
方法的具体详情如下:
包路径:android.widget.SearchView
类名称:SearchView
方法名:setSubmitButtonEnabled
暂无
代码示例来源:origin: bumptech/glide
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.search_activity, menu);
searchView = (SearchView) menu.findItem(R.id.search).getActionView();
searchView.setSubmitButtonEnabled(true);
searchView.setIconified(false);
searchView.setOnQueryTextListener(this);
return true;
}
代码示例来源:origin: commonsguy/cw-omnibus
private void configureSearchView(Menu menu) {
MenuItem search=menu.findItem(R.id.search);
search.setOnActionExpandListener(this);
sv=(SearchView)search.getActionView();
sv.setOnQueryTextListener(this);
sv.setSubmitButtonEnabled(true);
sv.setIconifiedByDefault(true);
if (initialQuery != null) {
sv.setIconified(false);
search.expandActionView();
sv.setQuery(initialQuery, true);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private void configureSearchView(Menu menu) {
MenuItem search=menu.findItem(R.id.search);
sv=(SearchView)search.getActionView();
sv.setOnQueryTextListener(this);
sv.setOnCloseListener(this);
sv.setSubmitButtonEnabled(false);
sv.setIconifiedByDefault(true);
if (initialQuery != null) {
sv.setIconified(false);
search.expandActionView();
sv.setQuery(initialQuery, true);
}
}
代码示例来源:origin: stackoverflow.com
mSearchView.setSubmitButtonEnabled(true);
mSearchView.setQueryHint("Search Here");
代码示例来源:origin: kingargyle/adt-leanback-support
public static void setSubmitButtonEnabled(View searchView, boolean enabled) {
((SearchView) searchView).setSubmitButtonEnabled(enabled);
}
代码示例来源:origin: stackoverflow.com
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search));
searchView.setSubmitButtonEnabled(true); // to enable submit button
ImageView b = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_go_btn);
b.setImageResource(android.R.drawable.ic_menu_search); //to change submit button icon
TextView a=(TextView) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
a.setTextColor(...); //to change color of search text
代码示例来源:origin: SunAlwaysOnline/Sukeda
private void initSearchView(View v) {
searchView = (SearchView) v.findViewById(R.id.sv_entry_category);
searchView.setSubmitButtonEnabled(true);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
EntryCategoryUtil.get_entry_category_mohu(s, new EntryCategoryUtil.mohu_categoryCall() {
@Override
public void success(final List<EntryCategory> list) {
initSearchViewData(list);
}
});
return false;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
}
代码示例来源:origin: SunAlwaysOnline/Sukeda
private void initSearchView(View v) {
searchView = (SearchView) v.findViewById(R.id.sv_entry);
searchView.setSubmitButtonEnabled(true);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
EntryUtil.get_entry_mohu(categoryId, query, new EntryUtil.get_entry_mohuCall() {
@Override
public void success(List<Entry> list) {
initSearchViewData(list);
}
});
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
代码示例来源:origin: stackoverflow.com
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
{
inflater.inflate(R.menu.searchview, menu);
MenuItem item = menu.findItem(R.id.menu_item_search);
SearchView sv = (SearchView) item.getActionView();
if (sv != null){
sv.setSubmitButtonEnabled(true);
sv.setOnQueryTextListener(this);
}
super.onCreateOptionsMenu(menu, inflater);
}
代码示例来源:origin: stackoverflow.com
searchView.setSubmitButtonEnabled(false);
mSearchEditFrame = searchView
.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
代码示例来源:origin: stackoverflow.com
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.main, menu);
MenuItem searchViewItem = menu.findItem(R.id.search);
SearchView searchView = (SearchView) searchViewItem.getActionView();
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(350, FrameLayout.LayoutParams.WRAP_CONTENT);
searchView.setLayoutParams(lp);
searchView.setIconifiedByDefault(false);
searchView.setSubmitButtonEnabled(false);
return true;
}
public void startQuickSearchActivity(MenuItem menuItem){
startActivity(new Intent(this, QuickSearchActivity_.class));
}
代码示例来源:origin: stackoverflow.com
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchview = (SearchView) MenuItemCompat.getActionView(searchItem);
searchview.setIconifiedByDefault(true);
searchview.setOnQueryTextListener(this);
searchview.setSubmitButtonEnabled(true);
searchview.setQueryHint("Search Here");
super.onCreateOptionsMenu(menu, inflater);
}
代码示例来源:origin: commonsguy/cw-androidarch
private void configureSearchView(Menu menu) {
MenuItem search=menu.findItem(R.id.search);
sv=(SearchView)search.getActionView();
sv.setOnQueryTextListener(this);
sv.setOnCloseListener(this);
sv.setSubmitButtonEnabled(true);
sv.setIconifiedByDefault(true);
}
代码示例来源:origin: stackoverflow.com
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.clear();
switch ((int) _viewPager.getCurrentItem()) {
case 0:
getSupportMenuInflater().inflate(R.menu.empty_menu, menu);
break;
case 1:
getSupportMenuInflater().inflate(R.menu.action_bar_menu, menu);
MenuItem searchItem = menu.findItem(R.id.search);
SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setSubmitButtonEnabled(true);
searchView.setOnQueryTextListener(queryTextListener);
break;
case 2:
getSupportMenuInflater().inflate(R.menu.empty_menu, menu);
break;
}
return super.onPrepareOptionsMenu(menu);
}
代码示例来源:origin: billthefarmer/editor
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
searchItem = menu.findItem(R.id.search);
SearchView searchView = (SearchView) searchItem.getActionView();
if (searchView != null)
{
searchView.setSubmitButtonEnabled(true);
searchView.setImeOptions(EditorInfo.IME_ACTION_GO);
searchView.setOnQueryTextListener(new QueryTextListener());
}
return true;
}
代码示例来源:origin: li2/learning-android-open-source
private void setupSearchView() {
mSearchView.setIconifiedByDefault(false);
mSearchView.setOnQueryTextListener(this);
mSearchView.setSubmitButtonEnabled(false);
mSearchView.setQueryHint(getString(R.string.cheese_hunt_hint));
}
代码示例来源:origin: qiubiteme/android_api_demos
private void setupSearchView() {
mSearchView.setIconifiedByDefault(false);
mSearchView.setOnQueryTextListener(this);
mSearchView.setSubmitButtonEnabled(false);
mSearchView.setQueryHint(getString(R.string.cheese_hunt_hint));
}
代码示例来源:origin: SunAlwaysOnline/Sukeda
private void initViews() {
ly_back = (LinearLayout) findViewById(R.id.ly_back);
ly_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
searchView = (SearchView) findViewById(R.id.sv);
searchView.setSubmitButtonEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.rv_book);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
//book_list=null;
BookUtil.page = 1;
BookUtil.all_books = 0;
initData(s);
setAblExpanded(false);
//搜索后失去焦点
searchView.clearFocus();
return false;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
}
代码示例来源:origin: stackoverflow.com
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
MenuItem searchMenuItem = menu.findItem(R.id.search);
SearchView searchView = (SearchView) searchMenuItem.getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setSubmitButtonEnabled(true);
searchView.setOnQueryTextListener(this);
setMenuTextColor(menu, R.id.displaySummary, R.string.show_summary);
setMenuTextColor(menu, R.id.about, R.string.text_about);
setMenuTextColor(menu, R.id.importExport, R.string.import_export);
setMenuTextColor(menu, R.id.preferences, R.string.settings);
return true;
}
private void setMenuTextColor(Menu menu, int menuResource, int menuTextResource) {
MenuItem item = menu.findItem(menuResource);
SpannableString s = new SpannableString(getString(menuTextResource));
s.setSpan(new ForegroundColorSpan(Color.BLACK), 0, s.length(), 0);
item.setTitle(s);
}
代码示例来源:origin: stackoverflow.com
mSearchView.setIconifiedByDefault(false);
mSearchView.setOnQueryTextListener(this);
mSearchView.setSubmitButtonEnabled(true);
mSearchView.setQueryHint("Search Here");
内容来源于网络,如有侵权,请联系作者删除!