本文整理汇总了Java中android.widget.SearchView.setIconified方法的典型用法代码示例。如果您正苦于以下问题:Java SearchView.setIconified方法的具体用法?Java SearchView.setIconified怎么用?Java SearchView.setIconified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SearchView
的用法示例。
在下文中一共展示了SearchView.setIconified方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.share_menu, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchManager searchManager = (SearchManager) this.getSystemService(Context.SEARCH_SERVICE);
if (searchItem != null) {
mSearchView = (SearchView) searchItem.getActionView();
}
if (mSearchView != null) {
mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
mSearchView.setIconified(false);
mSearchView.setQueryHint(getString(R.string.search_view_hint));
mSearchView.setMaxWidth(getResources().getDimensionPixelOffset(R.dimen.BU_22));
}
setListenerForSearchView();
return super.onCreateOptionsMenu(menu);
}
示例2: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.search_activity, menu);
searchView =
(SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search));
searchView.setSubmitButtonEnabled(true);
searchView.setIconified(false);
searchView.setOnQueryTextListener(this);
return true;
}
示例3: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@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;
}
示例4: initView
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
protected void initView() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mActionBar = getSupportActionBar();
if(mActionBar!=null) mActionBar.setDisplayHomeAsUpEnabled(false);
mActionBar.setTitle("");
mSearch = (SearchView) findViewById(R.id.search_view);
mSearch.setIconified(false);
mSearch.clearFocus();
}
示例5: onBackPressed
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
SearchView searchView = (SearchView) findViewById(R.id.search);
if (!searchView.isIconified()) {
searchView.setIconified(true);
} else {
super.onBackPressed();
}
}
示例6: onOptionsItemSelected
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_preferences) {
Intent prefIntent = new Intent(HomepageGuestActivity.this, MyDietActivity.class);
startActivity(prefIntent);
return true;
}
if (id == R.id.search) {
SearchView searchView = (SearchView) item.getActionView();
//searchView.dispatchSetActivated();
// TODO - Remove unnecessary function calls
searchView.dispatchSetActivated(true);
searchView.setPressed(true);
searchView.setSelected(true);
searchView.setEnabled(true);
searchView.setFocusable(true);
searchView.setIconified(false);
searchView.requestFocusFromTouch();
return true;
}
return true;
}
示例7: onPrepareOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onPrepareOptionsMenu(Menu menu) {
final MenuItem searchItem = menu.findItem(R.id.action_lookup);
searchView = (SearchView)searchItem.getActionView();
searchView.setOnQueryTextListener(this);
if(openSearch){
searchView.setIconified(false);
searchView.setQuery(textQuery,false);
searchView.requestFocus();
}
}
示例8: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_search, menu);
final MenuItem searchItem = menu.findItem(R.id.search_view);
mSearchView = (SearchView) searchItem.getActionView();
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
mSearchView.setIconified(false);
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
sharedPreferences.edit().putString(USER_QUERY, query).apply();
mSearchView.clearFocus();
finish();
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
return true;
}
});
mSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
finish();
return false;
}
});
return true;
}
示例9: makeSearchMenuEntry
import android.widget.SearchView; //导入方法依赖的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;
}
示例10: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_add_remove_fragment, menu);
// Setup SearchView
SearchManager searchManager = (SearchManager)getActivity().getSystemService(Context.SEARCH_SERVICE);
MenuItem searchItem = menu.findItem(R.id.search);
searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
networkRecyclerAdapter.getFilter().filter(newText);
return true;
}
});
// Recreate the last search if the screen was rotated
if(last_filter_term != null && last_filter_term.length() > 0){
searchView.setQuery(last_filter_term, true);
searchView.setIconified(false);
searchView.clearFocus();
}
}
示例11: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_manage_poi, menu);
final MenuItem searchItem = menu.findItem(R.id.action_search);
searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
onQueryTextChange(query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
typesAdapter.getFilter().filter(newText);
filterConstraint = newText;
return true;
}
});
if (!showingTypes) {
searchView.setVisibility(View.GONE);
}
if (showingTypes && !StringUtils.isEmpty(filterConstraint)) {
searchView.setIconified(false);
searchView.setQuery(filterConstraint, true);
}
return true;
}
示例12: onCreate
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.searchfriends);
mSearchView = (SearchView) findViewById(R.id.searchView1);
mSearchView.setIconifiedByDefault(true);
mSearchView.setQueryHint("按姓名或电子邮件搜索");
mSearchView.setIconified(false);
mSearchView.setFocusable(false);
mSearchView.clearFocus();
mSearchView.requestFocus();
mSearchView.setOnQueryTextListener(this);
mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
Log.i(MainActivity.TAG, "onfocus2---");
if(hasFocus){
Log.i(MainActivity.TAG, "onfocus---");
}else{
Log.i(MainActivity.TAG, "lost focus---");
}
}
});
mlv = (ListView) findViewById(R.id.search_list);
mSearchText = (TextView) findViewById(R.id.searchText);
mSearchText.setOnClickListener(this);
myRunner = BmobUser.getCurrentUser(RunUser.class);
}