當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。