当前位置: 首页>>代码示例>>Java>>正文


Java SearchView.setImeOptions方法代码示例

本文整理汇总了Java中android.widget.SearchView.setImeOptions方法的典型用法代码示例。如果您正苦于以下问题:Java SearchView.setImeOptions方法的具体用法?Java SearchView.setImeOptions怎么用?Java SearchView.setImeOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.SearchView的用法示例。


在下文中一共展示了SearchView.setImeOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);

    searchItem = menu.findItem(R.id.search);
    searchView = (SearchView) searchItem.getActionView();

    if (searchView != null)
    {
        searchView.setSubmitButtonEnabled(true);
        searchView.setImeOptions(EditorInfo.IME_ACTION_GO);
        searchView.setOnQueryTextListener(new QueryTextListener());
    }

    return true;
}
 
开发者ID:billthefarmer,项目名称:editor,代码行数:19,代码来源:Editor.java

示例2: onCreateView

import android.widget.SearchView; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.search_users_groups_layout, container, false);

    // Get the SearchView and set the searchable configuration
    SearchView searchView = (SearchView) view.findViewById(R.id.searchView);
    SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(
            getActivity().getComponentName())   // assumes parent activity is the searchable activity
    );
    searchView.setIconifiedByDefault(false);    // do not iconify the widget; expand it by default

    searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); // avoid fullscreen with softkeyboard

    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            Log_OC.v(TAG, "onQueryTextSubmit intercepted, query: " + query);
            return true;    // return true to prevent the query is processed to be queried;
            // a user / group will be picked only if selected in the list of suggestions
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;   // let it for the parent listener in the hierarchy / default behaviour
        }
    });

    return view;
}
 
开发者ID:skymania,项目名称:Cirrus,代码行数:36,代码来源:SearchShareesFragment.java

示例3: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	getMenuInflater().inflate(R.menu.actionbar_menu_searchmainactivity, menu);
	final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
	final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
	searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
	searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
	searchView.setIconifiedByDefault(false);
	searchView.setSubmitButtonEnabled(false);
	searchView.requestFocus();
	return super.onCreateOptionsMenu(menu);

}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:14,代码来源:SearchMainActivity.java


注:本文中的android.widget.SearchView.setImeOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。