本文整理汇总了Java中android.widget.SearchView.onActionViewExpanded方法的典型用法代码示例。如果您正苦于以下问题:Java SearchView.onActionViewExpanded方法的具体用法?Java SearchView.onActionViewExpanded怎么用?Java SearchView.onActionViewExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SearchView
的用法示例。
在下文中一共展示了SearchView.onActionViewExpanded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
// Associate searchable configuration with the SearchView
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.search).getActionView();
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
searchView.onActionViewExpanded();
return true;
}
示例2: onCreateOptionsMenu
import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
MenuItem searchMenuItem = menu.findItem(R.id.action_search);
MenuItem importItem = menu.findItem(R.id.action_import);
importItem.setVisible(true);
SearchView searchView = (SearchView) searchMenuItem.getActionView();
searchView.setQueryHint(getString(R.string.search));
searchView.onActionViewExpanded();
searchView.clearFocus();
searchView.setSubmitButtonEnabled(false);
searchView.setQueryRefinementEnabled(false);
searchView.setOnQueryTextListener(this);
}
示例3: initComponents
import android.widget.SearchView; //导入方法依赖的package包/类
private void initComponents()
{
application = (MusicApplication) getApplication();
/*搜索结果为空时,显示的提示信息*/
textTips = (TextView) findViewById(R.id.text_tips);
/*按钮类组件初始化*/
searchBack = (ImageButton) findViewById(R.id.image_search_back);
searchOption = (ImageButton) findViewById(R.id.image_search_option);
searchBack.setOnClickListener(this);
searchOption.setOnClickListener(this);
/*列表组件初始化*/
listView = (ListView) findViewById(R.id.list_search_result);
listView.setOnItemClickListener(this);
listView.setVisibility(View.INVISIBLE);
loadData();
/*搜索组件初始化*/
searchView = (SearchView) findViewById(R.id.view_search);
searchView.setOnQueryTextListener(this);
searchView.onActionViewExpanded(); // 默认出现点击输入状态
searchView.setFocusable(false);
searchView.clearFocus();
// searchView.setSubmitButtonEnabled(true);
}